how to combine these queries

Posted by mmcgrail on Stack Overflow See other posts from Stack Overflow or by mmcgrail
Published on 2010-03-17T13:53:21Z Indexed on 2010/03/17 14:01 UTC
Read the original article Hit count: 262

Filed under:

and get meaningful results.

Currently I am running these three queries:

  SELECT t.type,t.id,s.title FROM db1.tags t INNER JOIN db1.st s ON s.id=t.id WHERE id LIKE '%%' AND t.tag='foo' AND t.type='s' ORDER BY tag desc LIMIT 0, 19
  SELECT t.type,t.id,v.title FROM db1.tags t INNER JOIN db1.vi v ON v.id=t.id WHERE id LIKE '%%' AND t.tag='foo' AND t.type='v' ORDER BY tag desc LIMIT 0, 19
  SELECT t.type,t.id,i.ca AS title FROM db1.tags t INNER JOIN db2.tablename i ON i.id=t.id WHERE id LIKE '%%' AND t.tag='foo' AND t.type='i' ORDER BY tag desc LIMIT 0, 19

then trying to combine the data results but what I would really prefer is if I could combine them into a single query.

Any thoughts?

© Stack Overflow or respective owner

Related posts about mysql