Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Subquery question

Status
Not open for further replies.

SmileeTiger

Programmer
Mar 13, 2000
200
US
Does anyone see anything wrong with:

SELECT Notes FROM BT_Messages WHERE (Who = "USR_username1") OR (Who = "USR_ALL") OR (Who IN (SELECT GroupID FROM BT_Membership WHERE UserID = "username2")) GROUP BY UID,Notes ORDER BY UID
 
That will teach me to not read everything in the docs.

SELECT message FROM BT_MESSAGES, BT_MEMBERSHIP WHERE (BT_MESSAGES .Who = "USR_username1") OR (BT_MESSAGES.Who = "USR_ALL") OR (BT_MESSAGES.Who = BT_MEMBERSHIP.GroupID AND BT_MEMBERSHIP.GroupID = "username2") ;

Should work just fine.

Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top