Order By list order

  • Can I get a SELECT to return results in the order of an external list?

    For example:

    SELECT etc

    WHERE GuestID IN (guestlist)

    ORDER BY same order as guestlist

    Doug

  • Hi,

    Did you try to use derived tables to achieve this.

    select etc

    from tablea a, (select guestid, name from Guest order by guestid) as b

    where a.GuestId =b.guestid

    order by b.guestid

     

     


    Helen
    --------------------------------
    Are you a born again. He is Jehova Jirah unto me

  • Yes, that's the answer !

    Thanks so much for your help.

    Doug

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

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