Re: help in getting results from mysql

From: Date: Wed, 04 Jul 2001 04:38:25 +0000
Subject: Re: help in getting results from mysql
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-56118@lists.php.net to get a copy of this message
At 12:07 4/7/2001 +0930, David Robley wrote:
On Wed, 4 Jul 2001 00:00, Christian Dechery wrote: well... I tought of that. It doesn't work for many reasons: 1 - '*' always has to be the first on the select list 2 - you can't have expressions (max, min, avg) without a group by clause if you are handling multiple rows 3 - etc. etc.. etc... that's why I included the code in between the queries...
Try $rs1=mysql_query("select max(date) AS latest, * from tablename where item_id=34 and item_type_id=3"); but consider that you may possibly have multiple entries for the latest date?
Of course, had forgotten that. I think maybe you want UNION.
not really... the function I need is sub-selects. Union wouldn't help here... and still, mysql does not support UNION. I want something like this: select qty,value from tablename where exists (select max(date) from tablename where item_id=34 and item_type_id=3) and item_id=34 and item_type_id=3 ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer

« previous php.general (#56118) next »