Hi All,
I'm having difficulty in getting the data that I need from the DB.. and it is probably my lack of understanding in the query that I created...
data looks like this in the table called RandPtrack
rec_id type group_id open_date close_date orders shares order_date order_num
1 R 96 2012-02-14 22:55:05 2012-02-19 16:44:31 4 25 2012-02-19 16:44:31 123123
2 P 44 2012-02-14 22:55:58 0000-00-00 00:00:00 0 0 0000-00-00 00:00:00 0
4 R 97 2012-02-19 16:44:45 0000-00-00 00:00:00 0 0 0000-00-00 00:00:00 0
$sql_r="SELECT MAX(group_id), rec_id FROM RandPtrack where type='R'";
$result_r=mysql_query($sql_r);
$request_r=mysql_fetch_array($result_r);
$reserve=$request_r[0];
$reserve_rec=$request_r[1];
What I'm expecting to see is the Max group_id, where the type is R, which would be 97.
And the rec_id of 4 which is connected to the record with the max group_id
What I'm getting is the 97 for the max, but I'm getting rec_id 1...
So, what do I need to do to get the rec_id of the record that has the Max group_id ?
Any suggestions would be very helpful
Thanks in advance.
Douglas