MSFT SQL2000 -- WHERE, OR clause

Results 1 to 2 of 2

Thread: MSFT SQL2000 -- WHERE, OR clause

  1. #1
    christ tong Guest

    Default MSFT SQL2000 -- WHERE, OR clause

    Hi DataBase Guru,<BR> I have a problem here. In one my statement "Select .. WHERE SSN=5 OR SSN=1 OR SSN=2", I would select three users whose SSN is 5,1 or 2; and I wish that the database will return me the data in the SSN order of "5,1,2", as it appears in my SQL statement. But instead, the resultant return is sorted already as "1,2,5". Any suggestion please ? Thanks for Your Time and Patience.<BR><BR>Regards<BR>christ

  2. #2
    Join Date
    Dec 1969

    Default Some case

    You coukd try something like<BR><BR>select ssn, case ssn when 5 then 1 <BR> when 1 then 2 <BR> when 2 then 3 end as orderCriteria<BR> from t<BR>where ssn in (1,2,5)<BR>order by orderCriteria<BR><BR>Of course this is utterly useless if you have many possible ssn values

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts