Jump to content
  • Advertisement
Sign in to follow this  
Buzz1982

help in writing a difficult sql query

This topic is 3907 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
Advertisement
You need to look into sub queries for this one I think and I cannot remember the syntax for the life of me. Look at the MySql docs and it'll tell you there.

Share this post


Link to post
Share on other sites

This topic is 3907 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  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!