View Single Post

   
  #2 (permalink)  
Old 04-29-2008, 08:28 PM
beatbox
 
Posts: n/a
Default How to check for two different entries (same column) in one table?

Hi all,
I guess this must be a fairly common kind of query, but I'm not sure
how to go about it.
I have a table with columns nid and tid. I would like to return
results for nid where there are entries for tid=X AND tid=Y. So nid
appears twice, and in each case tid matches a different specific
value.

My query is as follows:

SELECT n.nid FROM node n, term_node t WHERE t.nid=n.nid AND n.status=1
AND t.tid= $group_term AND t.tid= $lesson_id ORDER BY n.nid DESC

Obviously this is not working, as it would only return a result if
$group_term and $lesson_id were equivalent. They are not.

Thanks for any help.
Reply With Quote