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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-24 : 08:47:38
Bala Kalyan writes "Say there is a tabele

tblMemberDetails with column memberId, membername, gender, country

I'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 about

Regards
Bala "

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
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-09-24 : 10:01:17
i think you're right samsekar.
Bala: use union all

select * form tblMemberDetails WHERE country = 'uk'
union all
select * form tblMemberDetails WHERE country <> 'uk'

Go with the flow & have fun! Else fight the flow
Go to Top of Page

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 all

select * form tblMemberDetails WHERE country = 'uk'
union all
select * form tblMemberDetails WHERE country <> 'uk'

Go with the flow & have fun! Else fight the flow




that translates to
select * form tblMemberDetails


if trying to order UK first then
select * form tblMemberDetails Order By case when country='uk' then 0 else 1 end, country



Corey
Go to Top of Page

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
Go to Top of Page

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
Go to Top of Page

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
Go to Top of Page
   

- Advertisement -