Hello Mumba, Hello Barry, 

> > How do I select out and filter only rows that match
> > both 16 and 62 in the KEYW_ID col?  IE.  The query
> > would return only 119 and 108?
> 
> I'm sure this could be done more effeciently other ways, possibly with
> a sub select if available, but something like this would probably
> work:
> 
>       SELECT temp1.*
>       FROM table_name AS temp1
>       LEFT JOIN table_name AS temp2
>       ON temp1.tbl_idx=temp2.tbl_idx
>       WHERE (temp1.keyw_id=16 AND temp2.keyw_id=62)
>               OR (temp1.keyw_id=62 AND temp2.keyw_id=16);
> 

I'm not sure which one is more efficient but I'd do it this way:

SELECT * FROM table 
WHERE KEYW_ID = 16 OR KEYW_ID = 62
GROUP BY TBL_IDX
HAVING COUNT(TBL_IDX) = 2;


Jean-Pierre
-- 
Powered by Linux From Scratch - http://schwicky.net/
PGP Key ID: 0xEE6F49B4 - AIM/Jabber: Schwicky - ICQ: 4690141

Nothing is impossible... Everything is relative!

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to