views:

43

answers:

1

Hi, i have a table with 2 columns tid and nid columns, i need to prepare a report to get common nodes between a tid. i.e table is like (tid, nid) (mysql,2) (mysql,3) (ajax,1) (ajax, 2)

now i need to get what what are the common nodes between ajax and mysql which is node2. i am looking for a query or some logic with database query in php

Adv thanks

+3  A: 

If you need this just for two specific tags, you can use something like this:

SELECT t1.nid
FROM table t1 JOIN table t2 ON t1.nid=t2.nid
WHERE t1.tid='mysql' AND t2.tid='ajax'
Lukáš Lalinský