vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| SELECT * FROM tblCountry WHERE Country_Id = 26 UNION ALL SELECT * FROM tblCountry WHERE Country_Id <> 26 --order by country_Name i need to select country_id =26 and then the rest i want them ordered by name. if i put order by country_name, the country_id 26 isn't displayed as the first one. is there anyway to apply the order by only to the second select not the whole? *** Sent via Developersdex http://www.developersdex.com *** |
| ||||
| ORDER BY CASE WHEN Country_Id = 26 THEN 1 ELSE 2 END, country_Name Roy Harvey Beacon Falls, CT On 16 Aug 2006 12:16:01 GMT, Marie-Christine Bechara <marie-christine.bechara@ifsal.com> wrote: > > >SELECT * > FROM tblCountry > WHERE Country_Id = 26 > UNION ALL > SELECT * > FROM tblCountry > WHERE Country_Id <> 26 > >--order by country_Name > >i need to select country_id =26 and then the rest i want them ordered by >name. >if i put order by country_name, the country_id 26 isn't displayed as the >first one. >is there anyway to apply the order by only to the second select not the >whole? > >*** Sent via Developersdex http://www.developersdex.com *** |