Re: Re: SQL Troubles with JOIN, GROUP BY and MAX???

From: Date: Tue, 04 Jun 2002 07:16:44 +0000
Subject: Re: Re: SQL Troubles with JOIN, GROUP BY and MAX???
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-19594@lists.php.net to get a copy of this message
At 04/06/2002 08:58, Evgeny Chuykov wrote:
Try something like this: SELECT USERS.Username,FILES.Filename FROM USERS LEFT JOIN FILES USING(Id) WHERE FILES.Filename IS NOT NULL ORDER BY FILES.Stamp DESC LIMIT 1;
I think it's wrong because Id isn't the matching column in 'FILES'. 2nd line should be 'FROM USERS LEFT JOIN FILES ON FILES.Userid = USER.Id' And 'LIMIT 1' return 1 line not the first line for each USER. I encounter such problem but I'm affraid that I didn't solve it :( -- Hubert ADGIE hubert.adgie@ispinfo.fr Tel : +33 5 53 88 00 76 Fax : +33 5 53 88 01 16

« previous php.db (#19594) next »