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
 General SQL Server Forums
 New to SQL Server Programming
 How to slect data from table ?

Author  Topic 

abhishek_kumar_rch
Starting Member

6 Posts

Posted - 2014-12-25 : 22:31:01
Hi,
I am designing a webpge using asp.net with sql server 2005
in back end there is table with followding columns
username,name,phone1,phone2,age and some others columns are there for storing user's details.

I would like to select in such a way so that i enter

more than one user name seperated with commas in textbox
in selection result i get all the phone numbers associated with that usernames.

For example

Usernames Name Phone1 Phone2
abc@yahoo.com Abhi 9334459287 9334459288
def@yahoo.com Sony 9935199351
efg@yahoo.com Tony 9835198351 9835198351


Select Phone1,Phone2 from tblregistration where usernames=abc@yahoo.com,def@yahoo.com,efg@yahoo.com


In result i like all the phone numbers
9334459287 9334459288
9935199351
9835198351 9835198351

Please help me.

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2014-12-26 : 01:37:55
Select Phone1,Phone2 from tblregistration where usernames in('abc@yahoo.com','def@yahoo.com','efg@yahoo.com')


Javeed Ahmed
https://www.linkedin.com/pub/javeed-ahmed/25/5b/95
Go to Top of Page
   

- Advertisement -