PDA

View Full Version : What's wrong....


Kyomu
02 Apr 2002, 05:28
What's wrong with the following SQL query?
SELECT forum.*, forumpermission.canpost, forumpermission.canview
FROM forum
LEFT JOIN forum ON forum.forumid=forumpermission.forumid
WHERE forum.displayorder<>0 AND forum.active=1 AND forum.isnews=1 AND forumpermission.usergroupid='$bbuserinfo[usergroupid]'
ORDER BY forum.parentid,forum.displayorder

I get the error:
Not unique table/alias: 'forum'

My brains are fired... help... =(

Chen
02 Apr 2002, 06:38
You are JOINing the forum table to itself without giving them an alias. That's the error, but in your code LEFT JOIN forum should be LEFT JOIN forumpermission.

Kyomu
02 Apr 2002, 17:16
Originally posted by FireFly
You are JOINing the forum table to itself without giving them an alias. That's the error, but in your code LEFT JOIN forum should be LEFT JOIN forumpermission.

Ah, thanks, it works now.
Now I'm getting a parse error here....


$threads=DB_site->query("SELECT threadid,forumid,dateline FROM thread WHERE $forumids ORDER BY dateline DESC");


Thanks for the help again.

Mark Hensler
02 Apr 2002, 21:08
$threads=$DB_site->

Kyomu
02 Apr 2002, 21:42
Originally posted by Mark Hensler
$threads=$DB_site->

Ahh, no wonder I couldn't pick it up... too used to C++...

Thanks.