Will Leshner wrote:
On Mon, 10 Jan 2005 13:49:21 -0800, [EMAIL PROTECTED]
By the way, "ORDER BY 1" I believe to mean order by column id = 1. So it's
not really a meaningless statement.
Is that true? I don't get the from the documentation, but I'm probably
just looking at it wrong.
Yes. You can put integer constants in an ORDER BY or GROUP BY
clause and they mean "use the N-th column of the result set".
So
SELECT x, y, z FROM table1 ORDER BY 2;
SELECT x, y, z FROM table1 ORDER BY y;
are equivalent. In fact, the first is transformed into the
second as part of the compilation process.
This is a standard SQL thing, apparently. It surprised me too
when I first found out about it (and had to fix SQLite to do it.)
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565