Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INNER JOIN same table twice? 1

Status
Not open for further replies.

snowboardr

Programmer
Feb 22, 2002
1,401
PH
I am basicly trying to select posts and grab the category names the post is in (ptid & ptid2) but I can't seem to get my INNER join to work... any suggestions?


Code:
SELECT post.ptid,post.ptid2,post.puid,post.psubject,post.ptype,post.ptime,thread1.tid,thread1.tname,thread2.tid,thread2.tname FROM forumpost as post, thread1 as thread INNER JOIN ON thread1.tid=post.ptid AND thread2.tid=post.ptid WHERE post.puid=2
 
*correction i had these swtiched... but still not working errors

thread as thread1
thread as thread2
 
Code:
SELECT post.ptid
     , post.ptid2
     , post.puid
     , post.psubject
     , post.ptype
     , post.ptime
     , thread1.tid
     , thread1.tname
     , thread2.tid
     , thread2.tname 
  FROM forumpost as post
INNER
  JOIN thread as thread1
    ON thread1.tid = post.ptid 
INNER 
  JOIN thread as thread2 
    ON thread2.tid = post.ptid2 
 WHERE post.puid = 2

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top