This is great information.  Thank you very much for a clear explanation,
Keith.  I guess I have to go back to using CTE's to get what I want in this
case.

Balaji Ramanathan

---------- Forwarded message ----------
From: Keith Medcalf <kmedc...@dessus.com>
To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Cc:
Bcc:
Date: Sat, 18 Nov 2017 09:16:57 -0700
Subject: Re: [sqlite] Confusion about DISTINCT keyword

Neither.  It has nothing to do with the DISTINCT keyword, which causes only
DISTINCT rows to be returned (duplicates are removed).

You misunderstanding is on the nature of a SCALAR.  A Scalar means ONE
value.  A correlated SCALAR subquery (a correlated subquery embedded as a
column in a select statement) can only return a SINGLE SCALAR result.

It matters not whether your subquery returns 1 or 1,000,000 rows.  Only the
value from the first row is returned.  Once this first row has been
determined the subquery is terminated.  (That is, it always has " LIMIT 1"
no matter what you might specify).

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says
a lot about anticipated traffic volume.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to