On 7/17/05, Darren Duncan <[EMAIL PROTECTED]> wrote:
> Assuming there actually is a meta-data function like ROW_NUMBER(),
> which is the ordinal value of the row in the query result, you can
> just do something like this:
> 
> SELECT <math between 'a' cols and 'b' cols>
> FROM (
>    SELECT ROW_NUMBER() AS myrownum, sq.*
>    FROM <ordered-sub-query> AS sq
> ) AS a FULL OUTER JOIN (
>    SELECT ROW_NUMBER + 1 AS myrownum, ...
>    FROM <ordered-sub-query> AS sq
> ) AS b ON b.myrownum = a.myrownum
> ...
> 

I suppose I could copy the data table into a temporary table with an
AUTOINCREMENT field.  (The row-set used to create the temporary
table's contents would be ordered appropriately.) The SQLite
documenataion quarantees AUTOINCREMENT fields to be "monotonically
increasing".  I'll try that out using the ideas you've given me.

Thanks for the insight, Darren.

Cheers,
Bill

Reply via email to