If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Retrieving data from another table with a given ID

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-17-06, 18:43
Zarathu Zarathu is offline
Registered User
 
Join Date: Nov 2006
Posts: 9
Retrieving data from another table with a given ID

http://i9.tinypic.com/2ynoyva.png

[Note: Ignore the duplicates, I was being careless.]

I want to know which command I would use, giving it "54352345" and have it return "FDSA."
Reply With Quote
  #2 (permalink)  
Old 11-17-06, 19:11
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
SELECT column_2
FROM the_table
WHERE column_1 = 54352345
Reply With Quote
  #3 (permalink)  
Old 11-18-06, 01:07
Zarathu Zarathu is offline
Registered User
 
Join Date: Nov 2006
Posts: 9
Excellent. If the given ID was nowhere to be found in column_1, what would it return? Null?
Reply With Quote
  #4 (permalink)  
Old 11-18-06, 04:34
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,407
It would return no rows at all

Don't understand me wrong: but before doing any further work you should read a good tutorial on database concepts and the SQL language
Reply With Quote
  #5 (permalink)  
Old 11-18-06, 06:27
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,259
Quote:
Originally Posted by shammat
It would return no rows at all

Don't understand me wrong: but before doing any further work you should read a good tutorial on database concepts and the SQL language
..good point, well made, Rudy's (r937) site has a good article from Paul Litwin that might be of interest
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On