FW: Query select value on MAX Date

FW: Query select value on MAX Date

am 25.02.2006 00:07:36 von Nur_Adman

------_=_NextPart_001_01C63997.1A6B1B7D
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Dear All,

=20

Sorry, I wrote the wrong result.

=20

The result I wanna get is :

=20

=20

Id | Category | Date |
Value

1 | A | 2005-02-21 |
2000

3 | B | 2006-01-20 |
4000

=20

But I got :

=20

Id | Category | Date |
Value

1 | A | 2005-02-21 |
3000

3 | B | 2006-01-20 |
5000

=20

=20

The MAX(Date) id correct, but the incorrect value...

=20

=20

Thanks & Regards,

Anita

=20

=20

=20

________________________________

From: Adman, Nur anita=20
Sent: Saturday, February 25, 2006 6:05 AM
To: 'php-db@lists.php.net'
Subject: RE: [PHP-DB] Query select value on MAX Date

=20

Dear All,

=20

I have table like this :

=20

Id | Category | Date |
Value

1 | A | 2005-02-21 |
2000

2 | A | 2004-01-21 |
3000

3 | B | 2006-01-20 |
4000

4 | B | 2005-12-11 |
5000

=20

I want to get the value for each Category where the date is MAX.

So I make the query like this :

=20

"SELECT MAX(Date), Value FROM table GROUP BY Category"

=20

But I get is :

=20

Id | Category | Date |
Value

1 | A | 2005-02-21 |
2000

3 | B | 2006-01-20 |
4000

=20

Could you help me please?

=20

Thanks & Regards,

=20

Anita

=20

=20

=20

=20

=20

=20

=20

=20


------_=_NextPart_001_01C63997.1A6B1B7D--