On Wed, 31 Aug 2011 08:12:10 -0400, "Igor Tandetnik"
wrote:
>Ivan Shmakov wrote:
>>> Tobias Vesterlund writes:
>>> Is it possible to get the highest value in a "limited column" when
>>> using LIMIT?
>>
>> Sure.
>>
>> SELECT max (id) FROM (SELECT
> Igor Tandetnik writes:
> Ivan Shmakov wrote:
> Tobias Vesterlund writes:
>>> Is it possible to get the highest value in a "limited column" when
>>> using LIMIT?
>> Sure.
>> SELECT max (id) FROM (SELECT id FROM t WHERE id > 0 LIMIT 10);
> This only
On 31 Aug 2011, at 8:38am, Tobias Vesterlund wrote:
> Is it possible to get the highest value in a "limited column" when using
> LIMIT?
Sort by that value. For instance,
SELECT id FROM t ORDER BY id DESC LIMIT 1
will give you the biggest value of 'id' that can be found. It's not needed in
Tobias Vesterlund wrote:
> But If I do SELECT max(id) FROM t WHERE id > 0 LIMIT 10; it will return 99.
>
> My logic, which may be flawed in this case, tells me the third SELECT should
> return 10 and not 99.
>
> Is it possible to get the highest value in a
Ivan Shmakov wrote:
>> Tobias Vesterlund writes:
>> Is it possible to get the highest value in a "limited column" when
>> using LIMIT?
>
> Sure.
>
> SELECT max (id) FROM (SELECT id FROM t WHERE id > 0 LIMIT 10);
This only works by accident. There's no requirement
On Wed, 31 Aug 2011 09:38:46 +0200, Tobias Vesterlund
wrote:
> Hi,
>
> I'm want to get the max value out of a certain column in a table.
>
> Table t has a column named id, which ranges from 0 to 99.
>
> If I do SELECT max(id) FROM t;
> it will return 99.
> If I
Right you are, thank you!
Regards,
Tobias
-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org]
On Behalf Of Ivan Shmakov
Sent: den 31 augusti 2011 10:13
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] max() with LIMIT
>>>
> Tobias Vesterlund writes:
[…]
> If I do SELECT max(id) FROM t; it will return 99.
> If I do SELECT id FROM t WHERE id > 0 LIMIT 10; it will return
> 1,2,3,4,5,6,7,8,9,10
> But If I do SELECT max(id) FROM t WHERE id > 0 LIMIT 10; it will
> return 99.
> My logic, which may be flawed
Hi,
I'm want to get the max value out of a certain column in a table.
Table t has a column named id, which ranges from 0 to 99.
If I do SELECT max(id) FROM t; it will return 99.
If I do SELECT id FROM t WHERE id > 0 LIMIT 10; it will return
1,2,3,4,5,6,7,8,9,10
But If I do SELECT max(id) FROM
9 matches
Mail list logo