I am an absolute Newbie. I have spent a lot of time in access and
decided to try and get my feet wet with learning a MySql and
ColdFusion or PHP to expand my skill set some.
Anyway, I got the basics of the select statement down, and have been
writing some good select statments, and getting back the query results
I want.
However, I am having a real logic problem with this one. I know what
I want, but I don't seem to be able to figure out how to write it. If
someone could explain the query to me, I would greatly appreciate it.
How Do I write a MySql select statement that will select all
information from 1 record based on the records with the highest value
within a group
My example would be, I want to know what the transaction code was for
the most recent transaction date for each customer
SAMPLE TABLE.
RECORD ID CUSTOMER TRANSACTION CODE TRANSACTION DATE
1 Alpha 3 01/01/2005
2 Bravo 3 01/01/2005
3 Charlie 3 01/01/2005
4 Alpha 5 01/02/2005
5 Bravo 4 01/03/2005
6 Alpha 2 01/03/2005
7 Alpha 2 01/05/2005
8 Bravo 7 01/07/2005
9 Alpha 3 01/07/2005
10 Alpha 2 01/06/2005
Result Set I Am Looking For
CUSTOMER TRANSACTION DATE TRANSACTION CODE
Alpha 01/07/2005 3
Bravo 01/07/2005 7
Charlie 01/01/2005 3
This is a simplified version of my actual data. But I should be able
to write the real query I need, if someone can explain the logic of
the query to me using this example.
Thank you in Advanced,
Kevin
The php_mysql group is dedicated to learn more about the PHP/MySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/