RE: FN-FORUM Digest V1 #4298
date posted 7th January 2003 23:45
As far as I know, the UNION is the right way to do it given your table
structure. Don't think you can abbreviate it.
If possible, you should have a table ComputerThingys (or whatever) with a
ThingyType field identifying whether it's a Laptop/Handheld/System.
(ThingyTypeID referencing a table ThingyTypes if you want to get clever).
Then you could just have the one select statement.
[better column names could be used]
Probably..
(if you need the old tables for other code you can always create a VIEW for
Laptops, Handhelds, etc)
--
Richard
> I have a database in which I need the select statement
> to access multiple tables. I have a solution but it seems
> rather clunky if I extend it as far as I need to. This works
> for two -
>
> SELECT Ref, Manufacturer, Model, Price, Category,
> Special_Offer, Special_Text FROM Laptops
> UNION SELECT Ref, Manufacturer, Model, Price, Category,
> Special_Offer, Special_Text FROM Handhelds, Systems
>
> I need to reference 10 tables all with the same selected
> field names in common. I know there must be and easier way
> could somebody point me in the right direction.
>
> tia,
>
> Darren Yates
> [EMAIL REMOVED]
> http://dittodesign.co.uk