RE: Very confused with query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:  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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux