On 2/18/16, Simon Davies <simon.james.davies at gmail.com> wrote:
>
> Ok on sort order, but why
>
> SQLite version 3.8.11.1 2015-07-29 20:00:57
> Enter ".help" for usage hints.
> Connected to a transient in-memory database.
> Use ".open FILENAME" to reopen on a persistent database.
> sqlite>
> sqlite> select '11' <= 11;
> 0
> sqlite> select '11' <= cast(11 as integer);
> 1
>

The documentation says:  "An expression of the form "CAST(expr AS
type)" has an affinity thta is the same as a column with a declared
type of "type".".  Since the RHS of the <= operator now has affinity,
that affinity is applied to the LHS operand as well, resulting in both
operands being treated as integers for the purpose of the comparison.
-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to