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 2005 Forums
 Transact-SQL (2005)
 How to Get the Values?

Author  Topic 

brr_hyd
Starting Member

4 Posts

Posted - 2009-12-17 : 00:27:38
hi all,

iam new to sql queries. i have one problem. the problem is, in my database data is like this,

--------- ---------------------
policyNo provider
--------- ---------------------
4 skandia_bond
4 skandia_file
4 skandia_etc
5 skandia_bond

here my problem is i have to get only where policyno=4, and provider='skandia_bond' and provider='skandia_file'

output should be like this:

policyNo provider
--------- ---------------------
4 skandia_bond
4 skandia_file

so how to write query? plz help urgently.

Thanks
Ram.

rammohan
Posting Yak Master

212 Posts

Posted - 2009-12-17 : 00:39:03
selct policyno,provider from tableName where policyNo = 4 and provider in('skandia_bond','skandia_file')

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page

brr_hyd
Starting Member

4 Posts

Posted - 2009-12-17 : 00:50:01
Thank u Ram mohan. its working...
Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2009-12-17 : 00:53:43
u r most welcome.


One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page
   

- Advertisement -