RE: Query select value on MAX Date

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

 



Dear All,

 

I have table like this :

 

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

 

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

So I make the query like this :

 

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

 

But I get is :

 

Id         |   Category     |           Date                |
Value

1          |           A          |     2005-02-21           |
2000

3          |           B          |     2006-01-20           |
4000

 

Could you help me please?

 

Thanks & Regards,

 

Anita

 

 

 

 

 

 

 

 


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

  Powered by Linux