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:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old April 27th, 2000, 08:02 PM
tsalzer tsalzer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 2 tsalzer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have four tables (let's call them small tables), and in each are four identically named fields (ID, LName, FName, EMail). There is also other information that varies between tables.

I want to combine some of the data from each of the small tables into one big table to allow searches on all individuals. But I also want to create links in the search return where users can access the richer, more detailed information in the underlying small table.

Strategy to date:
<OL TYPE=A>
<LI>if big table exists, drop it
<LI>if big table not exist, create it
<LI>query small table, using INSERT INTO SELECT to populate big table
<LI>repeat query for each small table
</OL>

Problem: have not figured out how to add the source small table name into what is INSERTed into big table. Can get the unique id from small table, but getting table name and putting it into big table has me stumped URL.

Would appreciate some advice...

Tom

Reply With Quote
  #2  
Old April 28th, 2000, 06:43 AM
dave1904 dave1904 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 23 dave1904 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Your database structure is not optimal.

You should create one table with all the products and common details. Let's say:
Prod_id, name, description, price. And for the specific details you make different tables (four different tables in you example). Let's say:
detailTable1: "Prod_id, 1detail1, 1detail2, 1detail3"
detailTable2: "Prod_id, 2detail1, 2detail3, 2detail3"
etc.

Mzzls
Dave

Reply With Quote
  #3  
Old April 28th, 2000, 09:28 AM
tsalzer tsalzer is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 2 tsalzer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, Dave. I agree, my table structure is not optimal. We started with one table, and as we incorporated very different groups of people, we let their differences as groups influence us, resulting in creating tables that are not normalized. Should have normalized then -- and this is on my long-range set of tasks -- but no time right now.

In the meantime, the workaround I would prefer would be a UNION of the tables, but that is not supported in my version of MySQL. Any other options or ideas will be much appreciated.

Tom

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > How to get table name from SELECT?


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