I have a number of different tables all containing a field called keywords I want to list all the titles from each table where a certain keyword exists and I was wondering if it is possible to do this in a single query? Would something like SELECT title FROM table1, table2, table3 WHERE keywords LIKE '%$keyword%' work?
you can do! select table1.field as field1, table2.field as field2 from table1 inner join table2 on table1.fieldx = table2.fieldy where ... I don't think you can actually merge 2 fields together though...
Are the tables connect in anyway? If not (and even if so) you'll probably be best using union SELECT title FROM table1 WHERE keywords LIKE '%$keyword%' UNION SELECT title FROM table2 WHERE keywords LIKE '%$keyword%' UNION SELECT title FROM table3 WHERE keywords LIKE '%$keyword%' Code (markup):