use more than two tables

Thread Solved

Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

use more than two tables

 
0
  #1
Jul 25th, 2008
hi,
i want to select from more than two table using a single mysql query.please tell me a example query/.
thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,076
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: use more than two tables

 
0
  #2
Jul 25th, 2008
you can use joins for this:
  1. "select * from table1 as t1,table2 as t2 where ti.id=t2.id";

this is simple....
Have look on this url follows:
http://www.tizag.com/mysqlTutorial/mysqljoins.php
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: use more than two tables

 
0
  #3
Jul 25th, 2008
thanks.i tried this way
  1. SELECT article.id,article.ar_title,article.owner,article.ar_date,addinfo.pat,login.username
  2. FROM article
  3. LEFT JOIN (
  4. login,addinfo
  5. ) ON ( login.id = article.owner
  6. AND login.id = addinfo.userid
  7. AND article.owner = addinfo.userid )
  8. WHERE article.owner =17
  9. LIMIT 0 , 30 ORDER BY article.ar_date DESC
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the MySQL Forum


Views: 943 | Replies: 2
Thread Tools Search this Thread



Tag cloud for MySQL
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC