That would work.  In fact, my current solution, which actually pipes
to perl, works pretty well.  It's just that I have to then import the
data back into the database.  So, I'd prefer to do the process
entirely in SQL.

I was thinking maybe a view, but that didn't work.  Apparently, there
is no rowid with views (or is there something equivalent that I'm
overlooking?).

$ sqlite3 db 'create view bar as select * from foo order by field desc;
                    select rowid, * from bar ; '
|c
|b
|a

Substituting a temporary table for the view works:

$ sqlite3 db 'create temporary table bat as select * from foo order by
field desc;
                    select rowid, * from bat ; '
1|c
2|b
3|a

Any limitations to consider when using a temporary table?  Any other ideas?

Regards,
- Robert

On Fri, Mar 27, 2009 at 3:37 PM, Thomas Briggs <[email protected]> wrote:
>   Holy cow that feels inefficient.
>
>   It's a bit clunky, but why not insert into a temporary table,
> ordered as desired, and then use the rowid from the temp table?
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to