Re: Very confused with query
| From: | Ronaldo Villarosa | Date: | Sat, 05 Jul 2003 18:45:59 +0000 |
| Subject: | Re: Very confused with query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-29104@lists.php.net to get a copy of this message | ||
This one works, just change the fields...
SELECT transaction_user_id, Max(transaction_date) AS transaction_max_date, *
FROM transactions group by transaction_user_id;
This works... but I tried it on a number field instead of date... but it
should handle the same way...
Ronald Villarosa
www.pabahay.com
www.bullsandbears.net
www.2datop.com
"Sparky Kopetzky" <sparkyk@blackmesa-isp.net> wrote in message
news:000801c34311$3c087c80$82dbfcd0@blackmesaisp.net...
Good morning!!
I'm trying to select 1 and only one record from each user based on the last
date from a transaction file. This is what I'm using and it's not even
close. It seems DISTINCT does not work!!
SELECT DISCTINCT(transaction_user_id), MAX(transaction_date), * FROM
transaction;
Could some kind soul help me figure this one out??
Robin E. Kopetzky
Black Mesa Computers/Internet Services
www.blackmesa-isp.net