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)
 Like Condition

Author  Topic 

girishkardam
Starting Member

13 Posts

Posted - 2008-10-15 : 02:41:47
Hi Frnds,

I am having two columns Phone1 & Phone2. Phone1 field is having multiple phone number seperated by , and Phone2 field is having single phone number. I want to compare both the fields and fetch only those rows which are having same phone number.



madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-15 : 03:15:36
Where phone1=phone2

Post some sample data with expected result

Madhivanan

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

girishkardam
Starting Member

13 Posts

Posted - 2008-10-15 : 03:24:36
hi thx for the reply.

I am having data in following format

Phone1 Phone2
731-2525251,5689566 5689566
731-5678252,2365623 2621455

In the above example i am having common phone number in first record i.e 5689566 in both the fields while in second record there is not any same phone number in both fields.In this way i am hvg 30000 records and i want to fetch only those rows where same phone number is available in both the fields like in record one. I think this will my query.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-15 : 03:28:09
Where ','+phone1+',' like '%,'+phone2+',%'

Madhivanan

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

- Advertisement -