Re: [PHP-DB] Re: Problems with INNER JOIN

[email protected] (Chris)
Newsgroups php.db
Message-ID <[email protected]>
Martin Zvarík wrote:
> This will work:
> 
> $sql = "
> SELECT admin.AdminID, workorders.WHAT_YOU_WANT
> FROM admin
> INNER JOIN workorders ON admin.AdminID=workorders.AdminID
> HAVING admin.username='".$_SESSION['user']."'
> ";

Don't use having in this case - this should be a 'where' clause.

A 'having' clause is processed AFTER everything else (after where, after 
joins, after aggregate's are calculated like sum/max/min), using it like 
this will cause performance issues where you shouldn't have any.

-- 
Postgresql & php tutorials
http://www.designmagick.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.