RE: [PHP-DB] Very confused with query
| From: | Matthew Moldvan | Date: | Mon, 07 Jul 2003 19:17:55 +0000 |
| Subject: | RE: [PHP-DB] Very confused with query | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-29134@lists.php.net to get a copy of this message | ||
Hi Robin,
I think you are not using DISTINCT correctly ... try SELECT DISTINCT
whatever instead of the ()s. Also, the use of * and DISTINCT together
really makes no sense ... in the SQL, you are saying select only one record,
then select everything, which are opposites.
Don't mean to be rude, but I recommend picking up a good book on database
theory. :)
Regards,
Matthew Moldvan
System Administrator
Trilogy International, Inc.
-----Original Message-----
From: Sparky Kopetzky [mailto:sparkyk@blackmesa-isp.net]
Sent: Saturday, July 05, 2003 12:20 PM
To: PHP DB Group
Subject: [PHP-DB] Very confused with query
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