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 2008 Forums
 Transact-SQL (2008)
 Remove records based on two column values?

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-10-11 : 10:51:20
Hi friends ,

I have a table Customer and I would like to remove records from my select query when Customer_type is 'Regular' and Result is 'temp'.

Example
Customername,Customer_type,Result
john,Regular,temp
James,Regular,perm
Jack,Regular,temp

So from above data i just need James record..How is this done..thank you

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-10-11 : 11:33:51
SELECT *
FROM yourTable
WHERE NOT (Customer_type = 'regular' and Result = 'temp')

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2012-10-11 : 11:35:10
Thank you Jim
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-10-11 : 12:02:04
You're welcome.

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -