Sign in to follow this  

help in writing a difficult sql query

This topic is 3663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I want to write a query where i can select records by applying 'where' over the records rather than the fields in the table. U can understand what I am trying to say by an example. Let say we have a table named test as follows, id | tid | tag 1 | 1 | a 2 | 1 | b 3 | 2 | a 4 | 2 | b 5 | 3 | b 6 | 4 | a 7 | 5 | a 8 | 5 | b Now i want to select 'tid' value from the records that contains only 'a' and not 'b'. so in this situation it will only return the record where tid=4 because that is the only record that contains only 'a' and not 'b'. I tried my best but i couldn't come up with any query that can do this. If u know of any query that can perform this task i will appreciate a lot. Please help me in this regard. Thank you bye.

Share this post


Link to post
Share on other sites

This topic is 3663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this