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
 Newbie - Filtering a query

Author  Topic 

unikoman
Starting Member

32 Posts

Posted - 2006-02-17 : 04:08:22
Hi All

I am writing a query to list all users in 2 countries but exclude users which their name starts with _inactive_5#4$66899, holder_....

I wrote

Select position, subsidiaryName
from position
where subsidiaryname = 'country one' OR subsidiaryname= 'country 2'

I get a result but there are some names which are fake accounts

eg. names start with inactive_#@$%&*ijkgfhg

or with holder_uhgfjgj

how can I do write into the query so that only the proper names without the rows that are fake showing up. In other words i want all results for those 2 countries except ones starting with inactive or with holder......?

thank you:)

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2006-02-17 : 04:14:31
Select position, subsidiaryName
from position
where subsidiaryname in ('country one','country 2' )
and name not like 'holder_uhgfjgj%'
and name not like '_inactive_5#4$66899%'
Go to Top of Page

unikoman
Starting Member

32 Posts

Posted - 2006-02-17 : 08:23:18
thank you:)
Go to Top of Page
   

- Advertisement -