Incorrect result when using WHERE with with correlated sub-select query

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Incorrect result when using WHERE with with correlated sub-select query

Edson Poderoso
Using the chinook database available at:
https://github.com/lerocha/chinook-database

The following query should return 26 rows, instead I returns 15.


WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
FROM Customer c
JOIN Invoice i
ON i.CustomerId = c.CustomerId
GROUP BY 1, 2),
MbC AS ( SELECT Country, MAX(spent) spent
FROM GbC GROUP BY 1)
SELECT outerr.*
FROM GbC outerr
WHERE outerr.spent =
(SELECT spent
FROM MbC WHERE Country = outerr.Country)
ORDER BY 1, 3 DESC


--

Edson Poderoso
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect result when using WHERE with with correlated sub-select query

Simon Slavin-3


On 3 Sep 2018, at 2:32pm, Edson Poderoso <[hidden email]> wrote:

> The following query should return 26 rows, instead I returns 15.

Which version of SQLite ?

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect result when using WHERE with with correlated sub-select query

Keith Medcalf
In reply to this post by Edson Poderoso

Seems to return 26 rows for the current tip, what version are you experiencing the issue with?

SQLite version 3.25.0 2018-09-03 17:11:11
Enter ".help" for usage hints.
sqlite> .version
SQLite 3.25.0 2018-09-03 17:11:11 f1138a38bd23f201a35621a71e82c5718abddb42ab82938e9516ab9d43e4alt2
zlib version 1.2.11
gcc-8.1.0
sqlite> WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
   ...> FROM Customer c
   ...> JOIN Invoice i
   ...> ON i.CustomerId = c.CustomerId
   ...> GROUP BY 1, 2),
   ...> MbC AS ( SELECT Country, MAX(spent) spent
   ...> FROM GbC GROUP BY 1)
   ...> SELECT outerr.*
   ...> FROM GbC outerr
   ...> WHERE outerr.spent =
   ...> (SELECT spent
   ...> FROM MbC WHERE Country = outerr.Country)
   ...> ORDER BY 1, 3 DESC
   ...> ;
Argentina|56|37.62
Australia|55|37.62
Austria|7|42.62
Belgium|8|37.62
Brazil|1|39.62
Canada|3|39.62
Chile|57|46.62
Czech Republic|6|49.62
Denmark|9|37.62
Finland|44|41.62
France|43|40.62
Germany|37|43.62
Hungary|45|45.62
India|58|38.62
Ireland|46|45.62
Italy|47|37.62
Netherlands|48|40.62
Norway|4|39.62
Poland|49|37.62
Portugal|34|39.62
Spain|50|37.62
Sweden|51|38.62
USA|26|47.62
United Kingdom|52|37.62
United Kingdom|53|37.62
United Kingdom|54|37.62
sqlite>



---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>[hidden email]] On Behalf Of Edson Poderoso
>Sent: Monday, 3 September, 2018 07:32
>To: [hidden email]
>Subject: [sqlite] Incorrect result when using WHERE with with
>correlated sub-select query
>
>Using the chinook database available at:
>https://github.com/lerocha/chinook-database
>
>The following query should return 26 rows, instead I returns 15.
>
>
>WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
>FROM Customer c
>JOIN Invoice i
>ON i.CustomerId = c.CustomerId
>GROUP BY 1, 2),
>MbC AS ( SELECT Country, MAX(spent) spent
>FROM GbC GROUP BY 1)
>SELECT outerr.*
>FROM GbC outerr
>WHERE outerr.spent =
>(SELECT spent
>FROM MbC WHERE Country = outerr.Country)
>ORDER BY 1, 3 DESC
>
>
>--
>
>Edson Poderoso
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect result when using WHERE with with correlated sub-select query

Richard Hipp-3
In reply to this post by Edson Poderoso
On 9/3/18, Edson Poderoso <[hidden email]> wrote:
> Using the chinook database available at:
> https://github.com/lerocha/chinook-database
>
> The following query should return 26 rows, instead I returns 15.

How do you know that the correct answer is 26 rows instead of 15?

I tried to download the SQLite and PostgreSQL versions of the Chinook
database so that I could compare the answer and I am having difficulty
just instantiating two databases that have the same number of rows for
each table.  So I have, so far, been unable to even determine if
SQLite gets the same answer as PostgreSQL.  How are you determining
that the SQLite answer is wrong?

>
>
> WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
> FROM Customer c
> JOIN Invoice i
> ON i.CustomerId = c.CustomerId
> GROUP BY 1, 2),
> MbC AS ( SELECT Country, MAX(spent) spent
> FROM GbC GROUP BY 1)
> SELECT outerr.*
> FROM GbC outerr
> WHERE outerr.spent =
> (SELECT spent
> FROM MbC WHERE Country = outerr.Country)
> ORDER BY 1, 3 DESC
>
>
> --
>
> Edson Poderoso
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect result when using WHERE with with correlated sub-select query

David Raymond
In reply to this post by Edson Poderoso
From the downloads page linked in the original email I'm using Chinook_Sqlite.sqlite
File size: 1,067,008
Customer table: 59 records
Invoice table: 412 records

Confirmed I got the same results when loading a new empty database with their Chinook_Sqlite.sql script.

Query below copied and pasted using 3.24.0 yields 15 records.

Again, the question is: Why do you say it "should" return 26?



SQLite version 3.24.0 2018-06-04 19:24:41
Enter ".help" for usage hints.

sqlite> .version
SQLite 3.24.0 2018-06-04 19:24:41 c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca
gcc-7.3.0

sqlite> select count(*) from Customer;
QUERY PLAN
`--SCAN TABLE Customer USING COVERING INDEX IFK_CustomerSupportRepId
count(*)
59
Run Time: real 0.003 user 0.000000 sys 0.000000

sqlite> select count(*) from Invoice;
QUERY PLAN
`--SCAN TABLE Invoice USING COVERING INDEX IFK_InvoiceCustomerId
count(*)
412
Run Time: real 0.003 user 0.000000 sys 0.000000

sqlite> WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
   ...> FROM Customer c
   ...> JOIN Invoice i
   ...> ON i.CustomerId = c.CustomerId
   ...> GROUP BY 1, 2),
   ...> MbC AS ( SELECT Country, MAX(spent) spent
   ...> FROM GbC GROUP BY 1)
   ...> SELECT outerr.*
   ...> FROM GbC outerr
   ...> WHERE outerr.spent =
   ...> (SELECT spent
   ...> FROM MbC WHERE Country = outerr.Country)
   ...> ORDER BY 1, 3 DESC
   ...> ;
QUERY PLAN
|--CO-ROUTINE 0x538DE8
|  |--SCAN TABLE Customer AS c USING INDEX IPK_Customer
|  `--SEARCH TABLE Invoice AS i USING INDEX IFK_InvoiceCustomerId (CustomerId=?)
|--SCAN SUBQUERY 0x538DE8 AS outerr
|--CORRELATED SCALAR SUBQUERY
|  |--CO-ROUTINE 0x53B818
|  |  |--CO-ROUTINE 0x568FD8
|  |  |  |--SCAN TABLE Customer AS c USING INDEX IPK_Customer
|  |  |  `--SEARCH TABLE Invoice AS i USING AUTOMATIC COVERING INDEX (CustomerId=?)
|  |  |--SCAN SUBQUERY 0x568FD8
|  |  `--USE TEMP B-TREE FOR GROUP BY
|  `--SEARCH SUBQUERY 0x53B818 USING AUTOMATIC COVERING INDEX (Country=?)
`--USE TEMP B-TREE FOR ORDER BY
Country|CustomerId|spent
Argentina|56|37.62
Australia|55|37.62
Czech Republic|6|49.62
Denmark|9|37.62
Finland|44|41.62
France|43|40.62
India|58|38.62
Italy|47|37.62
Netherlands|48|40.62
Poland|49|37.62
Portugal|34|39.62
Sweden|51|38.62
USA|26|47.62
United Kingdom|52|37.62
United Kingdom|53|37.62
Run Time: real 0.032 user 0.000000 sys 0.000000

sqlite>


-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Edson Poderoso
Sent: Monday, September 03, 2018 9:32 AM
To: [hidden email]
Subject: [sqlite] Incorrect result when using WHERE with with correlated sub-select query

Using the chinook database available at:
https://github.com/lerocha/chinook-database

The following query should return 26 rows, instead I returns 15.


WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
FROM Customer c
JOIN Invoice i
ON i.CustomerId = c.CustomerId
GROUP BY 1, 2),
MbC AS ( SELECT Country, MAX(spent) spent
FROM GbC GROUP BY 1)
SELECT outerr.*
FROM GbC outerr
WHERE outerr.spent =
(SELECT spent
FROM MbC WHERE Country = outerr.Country)
ORDER BY 1, 3 DESC


--

Edson Poderoso
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect result when using WHERE with with correlated sub-select query

David Raymond
In reply to this post by Edson Poderoso
Ok, now I'm seeing the 25 you're talking about.

So we're saying that if you do

with A as (something 1),
     B as (something 2)
select foo from A, B

you get something different than

create temp table A as (something 1);
create temp table B as (something 2);
select foo from A, B


That does indeed seem fishy.



sqlite> create temp table GbC as SELECT c.Country, c.CustomerId, SUM(i.total) spent
   ...> FROM Customer c
   ...> JOIN Invoice i
   ...> ON i.CustomerId = c.CustomerId
   ...> GROUP BY 1, 2
   ...> ;
QUERY PLAN
|--SCAN TABLE Customer AS c USING INDEX IPK_Customer
|--SEARCH TABLE Invoice AS i USING INDEX IFK_InvoiceCustomerId (CustomerId=?)
`--SEARCH TABLE sqlite_master USING INTEGER PRIMARY KEY (rowid=?)
Run Time: real 0.000 user 0.000000 sys 0.000000

sqlite> create temp table MbC as SELECT Country, MAX(spent) spent
   ...> FROM GbC GROUP BY 1
   ...> ;
QUERY PLAN
|--SCAN TABLE GbC
|--USE TEMP B-TREE FOR GROUP BY
`--SEARCH TABLE sqlite_master USING INTEGER PRIMARY KEY (rowid=?)
Run Time: real 0.000 user 0.000000 sys 0.000000

sqlite> SELECT outerr.*
   ...> FROM GbC outerr
   ...> WHERE outerr.spent =
   ...> (SELECT spent
   ...> FROM MbC WHERE Country = outerr.Country)
   ...> ORDER BY 1, 3 DESC
   ...> ;
QUERY PLAN
|--SCAN TABLE GbC AS outerr
|--CORRELATED SCALAR SUBQUERY
|  `--SCAN TABLE MbC
`--USE TEMP B-TREE FOR ORDER BY
Country|CustomerId|spent
Argentina|56|37.62
Australia|55|37.62
Austria|7|42.62
Belgium|8|37.62
Brazil|1|39.62
Canada|3|39.62
Chile|57|46.62
Czech Republic|6|49.62
Denmark|9|37.62
Finland|44|41.62
France|43|40.62
Germany|37|43.62
Hungary|45|45.62
India|58|38.62
Ireland|46|45.62
Italy|47|37.62
Netherlands|48|40.62
Norway|4|39.62
Poland|49|37.62
Portugal|34|39.62
Spain|50|37.62
Sweden|51|38.62
USA|26|47.62
United Kingdom|52|37.62
United Kingdom|53|37.62
Run Time: real 0.016 user 0.015600 sys 0.000000

sqlite> drop table MbC;
QUERY PLAN
|--SCAN TABLE sqlite_master
`--SCAN TABLE sqlite_master
Run Time: real 0.000 user 0.000000 sys 0.000000

sqlite> drop table GbC;
QUERY PLAN
|--SCAN TABLE sqlite_master
`--SCAN TABLE sqlite_master
Run Time: real 0.000 user 0.000000 sys 0.000000

sqlite> WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
   ...> FROM Customer c
   ...> JOIN Invoice i
   ...> ON i.CustomerId = c.CustomerId
   ...> GROUP BY 1, 2),
   ...> MbC AS ( SELECT Country, MAX(spent) spent
   ...> FROM GbC GROUP BY 1)
   ...> SELECT outerr.*
   ...> FROM GbC outerr
   ...> WHERE outerr.spent =
   ...> (SELECT spent
   ...> FROM MbC WHERE Country = outerr.Country)
   ...> ORDER BY 1, 3 DESC
   ...> ;
QUERY PLAN
|--CO-ROUTINE 0x5452C8
|  |--SCAN TABLE Customer AS c USING INDEX IPK_Customer
|  `--SEARCH TABLE Invoice AS i USING INDEX IFK_InvoiceCustomerId (CustomerId=?)
|--SCAN SUBQUERY 0x5452C8 AS outerr
|--CORRELATED SCALAR SUBQUERY
|  |--CO-ROUTINE 0x53B368
|  |  |--CO-ROUTINE 0x55DB08
|  |  |  |--SCAN TABLE Customer AS c USING INDEX IPK_Customer
|  |  |  `--SEARCH TABLE Invoice AS i USING AUTOMATIC COVERING INDEX (CustomerId=?)
|  |  |--SCAN SUBQUERY 0x55DB08
|  |  `--USE TEMP B-TREE FOR GROUP BY
|  `--SEARCH SUBQUERY 0x53B368 USING AUTOMATIC COVERING INDEX (Country=?)
`--USE TEMP B-TREE FOR ORDER BY
Country|CustomerId|spent
Argentina|56|37.62
Australia|55|37.62
Czech Republic|6|49.62
Denmark|9|37.62
Finland|44|41.62
France|43|40.62
India|58|38.62
Italy|47|37.62
Netherlands|48|40.62
Poland|49|37.62
Portugal|34|39.62
Sweden|51|38.62
USA|26|47.62
United Kingdom|52|37.62
United Kingdom|53|37.62
Run Time: real 0.015 user 0.000000 sys 0.015600

sqlite>


-----Original Message-----
From: David Raymond
Sent: Wednesday, September 05, 2018 10:10 AM
To: SQLite mailing list
Subject: RE: [sqlite] Incorrect result when using WHERE with with correlated sub-select query

From the downloads page linked in the original email I'm using Chinook_Sqlite.sqlite
File size: 1,067,008
Customer table: 59 records
Invoice table: 412 records

Confirmed I got the same results when loading a new empty database with their Chinook_Sqlite.sql script.

Query below copied and pasted using 3.24.0 yields 15 records.

Again, the question is: Why do you say it "should" return 26?



SQLite version 3.24.0 2018-06-04 19:24:41
Enter ".help" for usage hints.

sqlite> .version
SQLite 3.24.0 2018-06-04 19:24:41 c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca
gcc-7.3.0

sqlite> select count(*) from Customer;
QUERY PLAN
`--SCAN TABLE Customer USING COVERING INDEX IFK_CustomerSupportRepId
count(*)
59
Run Time: real 0.003 user 0.000000 sys 0.000000

sqlite> select count(*) from Invoice;
QUERY PLAN
`--SCAN TABLE Invoice USING COVERING INDEX IFK_InvoiceCustomerId
count(*)
412
Run Time: real 0.003 user 0.000000 sys 0.000000

sqlite> WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
   ...> FROM Customer c
   ...> JOIN Invoice i
   ...> ON i.CustomerId = c.CustomerId
   ...> GROUP BY 1, 2),
   ...> MbC AS ( SELECT Country, MAX(spent) spent
   ...> FROM GbC GROUP BY 1)
   ...> SELECT outerr.*
   ...> FROM GbC outerr
   ...> WHERE outerr.spent =
   ...> (SELECT spent
   ...> FROM MbC WHERE Country = outerr.Country)
   ...> ORDER BY 1, 3 DESC
   ...> ;
QUERY PLAN
|--CO-ROUTINE 0x538DE8
|  |--SCAN TABLE Customer AS c USING INDEX IPK_Customer
|  `--SEARCH TABLE Invoice AS i USING INDEX IFK_InvoiceCustomerId (CustomerId=?)
|--SCAN SUBQUERY 0x538DE8 AS outerr
|--CORRELATED SCALAR SUBQUERY
|  |--CO-ROUTINE 0x53B818
|  |  |--CO-ROUTINE 0x568FD8
|  |  |  |--SCAN TABLE Customer AS c USING INDEX IPK_Customer
|  |  |  `--SEARCH TABLE Invoice AS i USING AUTOMATIC COVERING INDEX (CustomerId=?)
|  |  |--SCAN SUBQUERY 0x568FD8
|  |  `--USE TEMP B-TREE FOR GROUP BY
|  `--SEARCH SUBQUERY 0x53B818 USING AUTOMATIC COVERING INDEX (Country=?)
`--USE TEMP B-TREE FOR ORDER BY
Country|CustomerId|spent
Argentina|56|37.62
Australia|55|37.62
Czech Republic|6|49.62
Denmark|9|37.62
Finland|44|41.62
France|43|40.62
India|58|38.62
Italy|47|37.62
Netherlands|48|40.62
Poland|49|37.62
Portugal|34|39.62
Sweden|51|38.62
USA|26|47.62
United Kingdom|52|37.62
United Kingdom|53|37.62
Run Time: real 0.032 user 0.000000 sys 0.000000

sqlite>


-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Edson Poderoso
Sent: Monday, September 03, 2018 9:32 AM
To: [hidden email]
Subject: [sqlite] Incorrect result when using WHERE with with correlated sub-select query

Using the chinook database available at:
https://github.com/lerocha/chinook-database

The following query should return 26 rows, instead I returns 15.


WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
FROM Customer c
JOIN Invoice i
ON i.CustomerId = c.CustomerId
GROUP BY 1, 2),
MbC AS ( SELECT Country, MAX(spent) spent
FROM GbC GROUP BY 1)
SELECT outerr.*
FROM GbC outerr
WHERE outerr.spent =
(SELECT spent
FROM MbC WHERE Country = outerr.Country)
ORDER BY 1, 3 DESC


--

Edson Poderoso
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect result when using WHERE with with correlated sub-select query

Richard Hipp-3
In reply to this post by Edson Poderoso
On 9/3/18, Edson Poderoso <[hidden email]> wrote:
> WHERE outerr.spent = (SELECT spent ...)

The "spent" column holds a floating-point number.  Depending on the
order of operations, the values might be off by an epsilon, resulting
in different floating point values and a failed comparison.  This is
why you should never perform equality comparisons of floating point
numbers.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Incorrect result when using WHERE with with correlated sub-select query

Keith Medcalf
In reply to this post by Edson Poderoso

Hehehe.  I didn't even notice the floating point equality test Richard, so here we go:

Try this one as 1e-13 is 1 ulp at a scale of 1000.0 ... which should be more than accurate enough in this case ...

WITH
 GbC AS (
         SELECT c.Country,
                c.CustomerId,
                SUM(i.total) as spent
           FROM Customer as c
           JOIN Invoice as i
             ON i.CustomerId = c.CustomerId
       GROUP BY c.Country, c.CustomerID
        ),
 MbC AS (
         SELECT Country,
                MAX(spent) as spent
           FROM GbC
       GROUP BY Country
        )
  SELECT *
    FROM GbC
   WHERE abs(spent - (SELECT spent
                        FROM MbC
                       WHERE Country = GbC.Country)) < 1e-13
ORDER BY Country, spent desc;

that will get around the floating point comparison issue (I have modified long ago my version of SQLite3 to "improve" the floating point accuracy in a number of places by doing aggregate arithmetic using 128-bit floats to avoid this issue).

I also have an extension builtin called feq(a, b[, u]) (also for all the comparison operations fne/fgt/fge/flt/fle) that compares that a and b are equal within u ulps of a where the default for u if not provided is 5 ... this avoids having to compute the epsilon for the expected scale of the comparison operation ...

WITH
 GbC AS (
         SELECT c.Country,
                c.CustomerId,
                SUM(i.total) as spent
           FROM Customer as c
           JOIN Invoice as i
             ON i.CustomerId = c.CustomerId
       GROUP BY c.Country, c.CustomerID
        ),
 MbC AS (
         SELECT Country,
                MAX(spent) as spent
           FROM GbC
       GROUP BY Country
        )
  SELECT *
    FROM GbC
   WHERE feq(spent, (SELECT spent
                       FROM MbC
                      WHERE Country = GbC.Country))
ORDER BY Country, spent desc;



---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>[hidden email]] On Behalf Of Edson Poderoso
>Sent: Monday, 3 September, 2018 07:32
>To: [hidden email]
>Subject: [sqlite] Incorrect result when using WHERE with with
>correlated sub-select query
>
>Using the chinook database available at:
>https://github.com/lerocha/chinook-database
>
>The following query should return 26 rows, instead I returns 15.
>
>
>WITH GbC AS ( SELECT c.Country, c.CustomerId, SUM(i.total) spent
>FROM Customer c
>JOIN Invoice i
>ON i.CustomerId = c.CustomerId
>GROUP BY 1, 2),
>MbC AS ( SELECT Country, MAX(spent) spent
>FROM GbC GROUP BY 1)
>SELECT outerr.*
>FROM GbC outerr
>WHERE outerr.spent =
>(SELECT spent
>FROM MbC WHERE Country = outerr.Country)
>ORDER BY 1, 3 DESC
>
>
>--
>
>Edson Poderoso
>_______________________________________________
>sqlite-users mailing list
>[hidden email]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users