Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Kit
2009/8/19 Mário Anselmo Scandelari Bussmann : > Both work for me, Kit solution is very fast, but I think John is right. In > my case, the tables have sequencial rowid. If I delete some row, then will > not work anymore. When you create an index of column data, John's

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Mário Anselmo Scandelari Bussmann
Both work for me, Kit solution is very fast, but I think John is right. In my case, the tables have sequencial rowid. If I delete some row, then will not work anymore. On Wed, Aug 19, 2009 at 12:44 PM, John Machin wrote: > On 20/08/2009 12:57 AM, Kit wrote: > > Right form

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Kit
2009/8/19 John Machin : > On 20/08/2009 12:57 AM, Kit wrote: >> Right form (tested): >> >> SELECT petr4.data AS data,petr4.preult AS preult,temp.data AS >> previous_data,temp.preult AS previous_preult >>FROM petr4,petr4 AS temp >>WHERE petr4.rowid=temp.rowid+1; > >

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread John Machin
On 20/08/2009 12:57 AM, Kit wrote: > Right form (tested): > > SELECT petr4.data AS data,petr4.preult AS preult,temp.data AS > previous_data,temp.preult AS previous_preult >FROM petr4,petr4 AS temp >WHERE petr4.rowid=temp.rowid+1; Don't you think that relying on (a) rowid being

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Mário Anselmo Scandelari Bussmann
I said its slow but I forget index. Now is as fast as a lightningbolt!! Thanks again! On Wed, Aug 19, 2009 at 12:23 PM, Mário Anselmo Scandelari Bussmann < mario.bussm...@gmail.com> wrote: > Bingo! This works very well (a little bit slow, since I have a 30 > rows). Thank you all!!! > > > On

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Mário Anselmo Scandelari Bussmann
Bingo! This works very well (a little bit slow, since I have a 30 rows). Thank you all!!! On Wed, Aug 19, 2009 at 11:42 AM, John Machin wrote: > On 20/08/2009 12:10 AM, Mário Anselmo Scandelari Bussmann wrote: > > I have a table like this: > > > > petr4 > > ---

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Kit
Right form (tested): SELECT petr4.data AS data,petr4.preult AS preult,temp.data AS previous_data,temp.preult AS previous_preult FROM petr4,petr4 AS temp WHERE petr4.rowid=temp.rowid+1; -- Kit ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread John Machin
On 20/08/2009 12:10 AM, Mário Anselmo Scandelari Bussmann wrote: > I have a table like this: > > petr4 > --- > rowid|data|preabe|premax|premin|preult|voltot > 1|2007-01-02|50.0|50.45|49.76|50.45|256115409.0 > 2|2007-01-03|50.16|50.4|48.01|48.7|492591256.0 [snip] >

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Kit
2009/8/19 Mário Anselmo Scandelari Bussmann : > I have a table like this: > > petr4 > --- > rowid|data|preabe|premax|premin|preult|voltot > 1|2007-01-02|50.0|50.45|49.76|50.45|256115409.0 > 2|2007-01-03|50.16|50.4|48.01|48.7|492591256.0 >

Re: [sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Pavel Ivanov
Without looking at your select statement it's very hard to help. But general suggestion is insert your results into temporary table and then issue a select on that table joined with itself with condition like t.rowid = prev.rowid + 1. Pavel On Wed, Aug 19, 2009 at 10:10 AM, Mário Anselmo

[sqlite] How to select data from 2 lines in one line?

2009-08-19 Thread Mário Anselmo Scandelari Bussmann
I have a table like this: petr4 --- rowid|data|preabe|premax|premin|preult|voltot 1|2007-01-02|50.0|50.45|49.76|50.45|256115409.0 2|2007-01-03|50.16|50.4|48.01|48.7|492591256.0 3|2007-01-04|48.5|48.75|47.4|47.65|505916186.0 4|2007-01-05|47.2|47.99|45.1|46.19|581485748.0