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)
 Select query with like operator

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2005-11-03 : 18:37:04
I would like to make multiple areacode search in i click:
Like if i type in the areacode text box like 305,954,786

comma delimiter:
then it should search for 305 and then search for 954 and then search for 786

and show the result in the shot with all consolidated resultset with 305 and 954 and 786:

select * from users where areacode like '".$areacode."';

Please can you help, Thank you very much for the information.

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2005-11-03 : 21:30:47
You can split these comma deliminated string and then send it to select statement but in a "in" clause.

For more information you can check the url below.

http://www.sqlteam.com/item.asp?ItemID=11499

Regards
Sachin


Don't sit back because of failure. It will come back to check if you still available. -- Binu
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-04 : 00:44:09
Try this also

select * from users where '%,'+@areacode+',%' like ','+areacodeColumn+','



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -