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)
 need select script

Author  Topic 

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-16 : 10:08:32
Hi guys,

I have a data like this:

Id fname
1 aa.xyz
2 aa.mno
3 bb.xyz
4 cc.xyz
5 aa.ttt

I wan to list all data fname like '%xyz%' but i don't want to list aa.xyz%

Bodestone
Starting Member

18 Posts

Posted - 2009-02-16 : 10:13:12
select id,fname
from mytable
where fname like '%xyz'
and fname not like 'aa.%'
Go to Top of Page

rudba
Constraint Violating Yak Guru

415 Posts

Posted - 2009-02-16 : 10:20:34
Thanks Bodestone
Go to Top of Page
   

- Advertisement -