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

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old November 22nd, 2006, 12:55 PM
mrsoft2010 mrsoft2010 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 4 mrsoft2010 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 59 sec
Reputation Power: 0
How not to repeat the same column ?

hi i'm a beginner in mysql and this is my 1st visit 2 this forum wish u can help me
i have 2 tables
the 1st containe column emp_num (primary)
the 2nd contains column emp_num (foreign)
i want 2 show all information in the 2 tables about employees without repeating the same column (emp_num)

select * from workers , inf where workers.emp_num = inf.emp_num;

the column emp_num appears twice in the result table
what's the solution

Reply With Quote
  #2  
Old November 22nd, 2006, 05:27 PM
fizker fizker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: denmark
Posts: 42 fizker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 18 m 18 sec
Reputation Power: 5
Send a message via MSN to fizker
the most simple way would be to write the specific columns you wish instead of everything. for example, if the inf have an id, a name and the emp_num, the select would be:

select workers.*, inf.id, inf.name from workers, inf where workers.emp_num = inf.emp_num
__________________
Benjamin Horsleben
horsleben.com/benjamin
Don't blame malice for what stupidity can explain

Reply With Quote
  #3  
Old November 23rd, 2006, 04:55 AM
mrsoft2010 mrsoft2010 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Posts: 4 mrsoft2010 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 59 sec
Reputation Power: 0
thanks alot
and we can do this

select workers.* , inf.event , inf.email from workers
inner join inf on workers.emp_num = inf.emp_num;

but the solution you posted is easier i think
thanks again

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > How not to repeat the same column ?


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 5 hosted by Hostway