Re: Re: Problems with INNER JOIN

From: Date: Thu, 29 Jan 2009 23:04:56 +0000
Subject: Re: Re: Problems with INNER JOIN
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-45916@lists.php.net to get a copy of this message
Actually I have tried EVERYTHING suggested and it just does not work, in my last query here I put in a user I know has orders and still nothing : $sql3 = "SELECT admin.AdminID, workorders.WorkOrderID, workorders.DATE_FORMAT(CreatedDate,'%m/%e/%y') AS SubmitDate, workorders.Location, workorders.AdminID, workorders.FormName, workorders.Status FROM admin INNER JOIN workorders ON admin.AdminID = workorders.AdminID WHERE admin.username = 'lhanford' "; Are there mySQL settings that could prevent JOINS? On Thu, Jan 29, 2009 at 3:44 PM, Chris <dmagick@gmail.com> wrote: > 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/ > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#45916) next »