Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Bala Kalyan writes "Say there is a tabeletblMemberDetails with column memberId, membername, gender, countryI'm searching for country = "uk"select * form tblMemberDetails WHERE country = 'uk'i get 4 records and reach EOF After displaying 4 records i want to retrive members from other countries.How to go aboutRegardsBala "
samsekar
Constraint Violating Yak Guru
437 Posts
Posted - 2004-09-24 : 09:04:03
Very Simple!! Select... country <> 'UK'.. LOL.Can you please provide some more details, Is that you want to order the query results such a way that UK is displayed first !!..- Sekar
spirit1
Cybernetic Yak Master
11752 Posts
Posted - 2004-09-24 : 10:01:17
i think you're right samsekar.Bala: use union allselect * form tblMemberDetails WHERE country = 'uk'union allselect * form tblMemberDetails WHERE country <> 'uk'Go with the flow & have fun! Else fight the flow
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts
Posted - 2004-09-24 : 10:07:23
quote:Originally posted by spirit1 i think you're right samsekar.Bala: use union allselect * form tblMemberDetails WHERE country = 'uk'union allselect * form tblMemberDetails WHERE country <> 'uk'Go with the flow & have fun! Else fight the flow
that translates toselect * form tblMemberDetailsif trying to order UK first thenselect * form tblMemberDetails Order By case when country='uk' then 0 else 1 end, countryCorey
spirit1
Cybernetic Yak Master
11752 Posts
Posted - 2004-09-24 : 10:09:31
or that ... i know that's really usefull, but i don't like that.Go with the flow & have fun! Else fight the flow
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts
Posted - 2004-09-24 : 10:10:59
i don't ever use it... but it does work Corey
spirit1
Cybernetic Yak Master
11752 Posts
Posted - 2004-09-24 : 10:12:57
that's an sql anomaly if u ask me... Go with the flow & have fun! Else fight the flow