|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have several news tables. Each one is structured the same for the moment, apart from the primary key. For example:
WorldNews ========= WorldNewsID | Headline | Article TownNews ======== TownNewsID | Headline | Article I want to be able to select all the articles from both tables together - to put them into one table so to speak, with the NewsID value being taken from the appropiate *NewsID column of each table. Hope that's clear! Just read over it and it might not be. Hope somebody understands... Ben. |
|
#2
|
|||
|
|||
|
I've had a similar situation this week. Union is not supported (yet), so the dreaded temporary table came to the rescue. Insert both sets of data into the one temp table and then do your select from there. If your primary keys overlap, then create an extra auto_increment column on the temp table.
|
|
#3
|
|||
|
|||
|
Thanks for your advice.
However, when I try and carry out a query including CREATE TEMPORARY TABLE - I keep getting errors in my syntax. However, when I remove the TEMPORARY from the statement, it is carried out okay. Basically, I am looking for somewhere on the web that gives me some advice on creating and using temporary tables with php3... not much to ask I hope (!) but the book I have is next to useless. Thanks, Ben. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Union of separate tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|