On Mon, 15 Feb 2016 14:19:12 -0700
Scott Robison wrote:
> Each job will take some amount of time to process. The order doesn't
> matter as long as all jobs are eventually processed and you have a
> single process running the jobs. Limit 1 is a reasonable way to grab
> a single job.
Reasonable, p
On Mon, 15 Feb 2016 14:55:34 -0700
"Keith Medcalf" wrote:
> Pretty sure you meant:
>
> select * from (select min(t) as t from T) as T;
Yes, thanks. :-)
--jkl
On Tue, Feb 16, 2016 at 11:44 AM, James K. Lowden
wrote:
> On Mon, 15 Feb 2016 14:19:12 -0700
> Scott Robison wrote:
>
> > Each job will take some amount of time to process. The order doesn't
> > matter as long as all jobs are eventually processed and you have a
> > single process running the jo
ginal Message-
From: sqlite-users-boun...@mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Gary
Briggs
Sent: Monday, 15 February 2016 11:47 AM
To: SQLite mailing list
Subject: Re: [sqlite] Correlated subquery throwing an error
On Mon, Feb 15, 2016 at 11:
On 15 Feb 2016, at 8:58pm, James K. Lowden wrote:
> Clemens Ladisch wrote:
>
>> I don't know why correlated subqueries cannot use values from the
>> outer query in the ORDER BY or LIMIT clauses;
>
> ORDER BY is not part of SELECT! It's not a relational operator.
> Per the SQL standard -- OR
On Mon, 15 Feb 2016 08:56:35 +0100
Clemens Ladisch wrote:
> I don't know why correlated subqueries cannot use values from the
> outer query in the ORDER BY or LIMIT clauses;
ORDER BY is not part of SELECT! It's not a relational operator.
Per the SQL standard -- ORDER BY cannot appear in a subq
On Mon, 15 Feb 2016 10:39:31 +0100
Clemens Ladisch wrote:
> > you need to explicitly limit a subquery that is a field and must
> > only ever return 1 result if the where clause is ambiguous about it
>
> Not in SQLite. (It ignores superfluous rows, and returns NULL if
> there are no rows.)
Yes,
On 02/15/2016 02:56 PM, Clemens Ladisch wrote:
> Gary Briggs wrote:
>>> SELECT
>>>a.id AS a_id,
>>>(SELECT b.id
>>> FROM foo AS b
>>> WHERE b.id!=a.id
>>> AND distance(a.x,a.y,b.x,b.y)<=25
>>> ORDER BY b.val, distance(a.x,a.y,b.x,b.y))
>>> FROM foo AS a
>> This is the bit
sqlite] Correlated subquery throwing an error
>
> On Mon, 15 Feb 2016 10:39:31 +0100
> Clemens Ladisch wrote:
>
> > > you need to explicitly limit a subquery that is a field and must
> > > only ever return 1 result if the where clause is ambiguous about it
> >
> &g
On Mon, Feb 15, 2016 at 2:05 PM, Simon Slavin wrote:
>
> On 15 Feb 2016, at 8:58pm, James K. Lowden
> wrote:
>
> > Clemens Ladisch wrote:
> >
> >> I don't know why correlated subqueries cannot use values from the
> >> outer query in the ORDER BY or LIMIT clauses;
> >
> > ORDER BY is not part of
On Mon, Feb 15, 2016 at 08:56:35AM +0100, Clemens Ladisch wrote:
> Gary Briggs wrote:
> >> SELECT
> >> a.id AS a_id,
> >> (SELECT b.id
> >>FROM foo AS b
> >>WHERE b.id!=a.id
> >> AND distance(a.x,a.y,b.x,b.y)<=25
> >>ORDER BY b.val, distance(a.x,a.y,b.x,b.y))
> >> FROM foo AS a
oun...@mailinglists.sqlite.org
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Gary
Briggs
Sent: Monday, 15 February 2016 10:43 AM
To: sqlite-users at mailinglists.sqlite.org
Subject: [sqlite] Correlated subquery throwing an error
I posted a question on stackoverflow, here:
h
R Smith wrote:
> you need to alias a subquery always when it is used in a join
Not in SQLite.
> you need to explicitly limit a subquery that is a field and must only
> ever return 1 result if the where clause is ambiguous about it
Not in SQLite. (It ignores superfluous rows, and returns NULL if
On 2016/02/15 3:01 AM, Gary Briggs wrote:
>
> This is the bit that doesn't seem to work; having
> distance(a.x,a.y,b.x,b.y) in the ORDER BY clause on the inner query is
> what appears to cause the error that it can't find a.x, from the outer query.
>
> It's not tied to it being a custom function;
Gary Briggs wrote:
>> SELECT
>> a.id AS a_id,
>> (SELECT b.id
>>FROM foo AS b
>>WHERE b.id!=a.id
>> AND distance(a.x,a.y,b.x,b.y)<=25
>>ORDER BY b.val, distance(a.x,a.y,b.x,b.y))
>> FROM foo AS a
>
> This is the bit that doesn't seem to work; having
> distance(a.x,a.y,b.x,b.y)
On Sun, Feb 14, 2016 at 07:31:43PM -0500, Richard Hipp wrote:
> On 2/14/16, Gary Briggs wrote:
> >
> > "For every row in that table, I want the entire row in that same table
> > within a certain distance [eg 25], with the lowest "val". For rows
> > with the same "val", I want to use lowest distanc
qlite.org
> [mailto:sqlite-users-bounces at mailinglists.sqlite.org] On Behalf Of Gary
> Briggs
> Sent: Monday, 15 February 2016 10:43 AM
> To: sqlite-users at mailinglists.sqlite.org
> Subject: [sqlite] Correlated subquery throwing an error
>
> I posted a question on stackoverf
On 2/14/16, Gary Briggs wrote:
>
> "For every row in that table, I want the entire row in that same table
> within a certain distance [eg 25], with the lowest "val". For rows
> with the same "val", I want to use lowest distance as a tie breaker."
>
Untested code follows.
I'l build up the answer
I posted a question on stackoverflow, here:
http://stackoverflow.com/questions/35382897/implementing-a-sql-query-without-window-functions
In short, I have a table that I'm trying to query:
CREATE TABLE foo (
id INTEGER PRIMARY KEY,
x REAL NOT NULL,
y REAL NOT NULL,
val REAL NOT NULL,
19 matches
Mail list logo