PDA

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


Kyomu
04-02-2002, 03:28 AM
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... =(

Admin
04-02-2002, 04:38 AM
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
04-02-2002, 03:16 PM
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
04-02-2002, 07:08 PM
$threads=$DB_site->

Kyomu
04-02-2002, 07:42 PM
Originally posted by Mark Hensler
$threads=$DB_site->

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

Thanks.