View Single Post
Old 12-04-2008, 18:22   #5 (permalink)
d3mcfadden
Senior Member
 
d3mcfadden's Avatar
 
Join Date: Apr 2005
Location: -
Posts: 694
Send a message via AIM to d3mcfadden
Quote:
Originally Posted by Encantado
Because i have in total 9 product tables with each their own specific fields.

That is flawed logic and terrible db design. In situations like that you abstract out all fields into their own table and join them back into to one products table.

Anyways, if you want to achieve what you are asking in one query there are two ways to do it, a temporary table or a union command. Using a temp table you select all rows from both tables INTO the temp table them select back out then DROP the temp table. Union will only work if you select the same exact fields from each table.

Code:
SELECT id, name FROM Saunas WHERE visible = 1 UNION SELECT id, name FROM Spas WHERE visible = 1

I would recommend updating your DB schema

Last edited by d3mcfadden : 13-04-2008 at 21:01.
  Reply With Quote