Nested Select subquery

  • Hi (again)

    I have modified a piece of code (suggested by Chris) that works on its own as a subquery but I am getting the following error;

    Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

    I have adapted the query as follows;

    SALES.ID,

    (SELECT TOP 1 PRODUCT.INFO FROM (SELECT TOP 2 * FROM PRODUCTS WHERE PRODUCTS.ID = SALES.ID AND DESC LIKE 'FLAG SET TO%' ORDER BY DATE DESC) d ORDER BY DATE)

    FROM SALES

    Any ideas on how I can combat this problem or use "EXISTS"?

    Thanks

  • You really should keep this in the same thread: http://www.sqlservercentral.com/Forums/Topic588510-1291-1.aspx

    Have you looked at the recent suggestions given there?

    😎

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply