Hey guys,

I was wondering if you could tell me if this is even possible or if it can be done another way???

So i have a database with 6 tables all the databases have the same columns except for the tables name ahead of the generic headers pub_name, Hotel_name, restaurant_Name etc.

Estentially i want to take all the values that meet the search criteria out of the 6 tables so if i want all the restaurants hotels and pubs that are in ennis can i do it??


Have you tried union all?

(select * from table1 where field1 = 'value to search') union all (select * from table2 where field1 = 'value to search') union all (select * from table3) order by field1;

Read this: http://dev.mysql.com/doc/refman/5.0/en/union.html

It is pissoble ..
Also TRy this
I always look here. When i had some probelm on query.

Yes, it is very possible. You can do a Union, left or right joins, depending on what you want to achieve.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.