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
 select Query Problem

Author  Topic 

rinu.urs
Starting Member

4 Posts

Posted - 2009-11-24 : 09:20:43
hi all

The table have lots of duplicate rows except for the last column skills
The skills has diffrent values some rows 'Middle East' and the other rows 'Resident Engineer', 'planner' etc

When the user enters the name and the skills set, he wants to see thouse who has all the skills set

Table sample

Name Address salary skills
samy d Dubai 1000 manager
samy d Dubai 1000 Resident Engineer
samy r Abu Dhabi 2000 manager
samy r Abu Dhabi 2000 Software



here i want to retry records of which has the name "samy"
and skills Resident Engineer and manager

There is lots of records with the name samy but i want to retry only the samy with the skills manager and resident Engineer



Please help



vedjha
Posting Yak Master

228 Posts

Posted - 2009-11-24 : 09:36:21
select * from table where name='samy' and (skills='Resident Engineer' or skills='manager')

http://kiransoftech.com
Go to Top of Page

rinu.urs
Starting Member

4 Posts

Posted - 2009-11-24 : 09:56:45
hi thanks for the replay

using this query gets me all the "samy" which has either skills='Resident Engineer' or skills='manager'

I want only the samy with skills 'Resident Engineer' AND skills='manager'

AND cannot be used on one column
Go to Top of Page
   

- Advertisement -