MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 13th, 2000, 08:05 AM
bpp198 bpp198 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: UK
Posts: 27 bpp198 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old July 13th, 2000, 09:39 AM
woodgnome woodgnome is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 29 woodgnome User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 43 sec
Reputation Power: 0
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.

Reply With Quote
  #3  
Old July 20th, 2000, 09:56 AM
bpp198 bpp198 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: UK
Posts: 27 bpp198 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Union of separate tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT