This can also help:
select id,value from table order by value desc limit 1;
Cheers
Claudio
2009/9/10 Slackli User
> Thanks all the info.
> Just got what I wanted.
>
> 2009/9/10 Wolfgang Schaefer :
> > John Daisley schrieb:
> >> SELECT MAX(value), id FROM table
> >> GROUP BY id;
> >>
> >>
>
Thanks all the info.
Just got what I wanted.
2009/9/10 Wolfgang Schaefer :
> John Daisley schrieb:
>> SELECT MAX(value), id FROM table
>> GROUP BY id;
>>
>>
>>
>
> I guess what Slackli had in mind was more something like this:
> SELECT id, value
> FROM table
> WHERE value = (SELECT max(value) FROM
John Daisley schrieb:
> SELECT MAX(value), id FROM table
> GROUP BY id;
>
> Regards
>
> John Daisley
> Mobile +44(0)7812 451238
> Email j...@butterflysystems.co.uk
>
> Certified MySQL 5 Database Administrator (CMDBA)
> Certified MySQL 5 Developer
> Cognos BI Developer
>
> ---
>
.
-Original Message-
From: Slackli User
Sent: Thursday, September 10, 2009 10:43 AM
To: mysql@lists.mysql.com
Subject: how to query this
Hello,
sorry I'm not good at SQL statement.
I have a table, whose stru is like:
idvalue
1 33
2 987
3 10
4 22
...
I
Hello,
sorry I'm not good at SQL statement.
I have a table, whose stru is like:
idvalue
1 33
2 987
3 10
4 22
...
I want to get the max value and the corresponding id, using this sql:
select max(value),id from table;
but it won't work.
so what's the
On Sun, April 29, 2007 05:28, Jeff Pang wrote:
> Hello list,
>
> I want to get the counter for db-items by each day,so I wrote this sql:
>
> select count(*) as dd from items group by updatetime;
>
> But sorry "updatetime" is "datetime" type,not "date" type.Then I can't get
> the correct result.
>
Hello list,
I want to get the counter for db-items by each day,so I wrote this sql:
select count(*) as dd from items group by updatetime;
But sorry "updatetime" is "datetime" type,not "date" type.Then I can't get the
correct result.
How can I do this?Thanks.
50 AMAZON-Einkaufsgutschein bei