Re: [sqlite] Store result of calculation or not

2011-06-13 Thread Ian Hardingham
Many thanks Igor. Would this index be enough: CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable (player1,player2) Or do I need the opposite as well? CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable (player2,player1) Why I have two queries: the order of the arguments are

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread Igor Tandetnik
BareFeetWare wrote: > On 12/06/2011, at 9:59 PM, Ian Hardingham wrote: >> Once again, multiturnTable has a million rows, I have separate indexes on >> complete and player1 and player2 (should I also add >> an index on player1, player2?) > > Yes. Since your query

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread BareFeetWare
On 12/06/2011, at 9:59 PM, Ian Hardingham wrote: > I often need to get the "record" between two people - how many games they've > won and lost against each other. For reference, the query is > SELECTcount(*) TotalGames > , sum(score > 0) GamesWonByPlayer1 > , sum(score < 0)

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread Igor Tandetnik
Ian Hardingham wrote: > Would this index be enough: > > CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable > (player1,player2) > > Or do I need the opposite as well? > > CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable > (player2,player1) For the queries

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread Ian Hardingham
Many thanks Igor. Would this index be enough: CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable (player1,player2) Or do I need the opposite as well? CREATE INDEX IF NOT EXISTS mtTablePlayer1 ON multiturnTable (player2,player1) Why I have two queries: the order of the arguments are

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread Igor Tandetnik
Ian Hardingham wrote: > I often need to get the "record" between two people - how many games > they've won and lost against each other. For reference, the query is at > the end of the email. Once again, multiturnTable has a million rows, I > have separate indexes on complete

[sqlite] Store result of calculation or not

2011-06-12 Thread Ian Hardingham
Guys, my apologies for spamming the list today. A topic I've talked about before, but am just revisiting. I often need to get the "record" between two people - how many games they've won and lost against each other. For reference, the query is at the end of the email. Once again,

Re: [sqlite] store result

2006-01-20 Thread manoj marathayil
thanks, i failed to notice that one, any way thanks for your replay Jay Sprenkle <[EMAIL PROTECTED]> wrote: On 1/19/06, manoj marathayil wrote: > ok this i can do, but the problem is i need to select a set of records and i > want to manipulate with each record then only i need to delete

Re: [sqlite] store result

2006-01-20 Thread Jay Sprenkle
On 1/19/06, manoj marathayil <[EMAIL PROTECTED]> wrote: > ok this i can do, but the problem is i need to select a set of records and i > want to manipulate with each record then only i need to delete that record That's why I had it separated. Select the set into a temporary table. Process the

Re: [sqlite] store result

2006-01-19 Thread manoj marathayil
ok this i can do, but the problem is i need to select a set of records and i want to manipulate with each record then only i need to delete that record Jay Sprenkle <[EMAIL PROTECTED]> wrote: On 1/19/06, manoj marathayil wrote: > > hi, > is there is any way so that i can store the result > of >

Re: [sqlite] store result

2006-01-19 Thread Jay Sprenkle
> I don't believe there is an option to "select into" in SQLite. So your > first statement should probably be a "create as". Also, you should > delete the temp table after the delete. Your solution should read like this: Oops! Too many database syntax records in my head at the same time! > >

Re: [sqlite] store result

2006-01-19 Thread Dennis Cote
Jay Sprenkle wrote: is there is any way so that i can store the result of a select query and execute a delete query on the same table with out using any other buffer? How about: select id into temp_table from source_table where somecondition = true; delete from source_table where id

Re: [sqlite] store result

2006-01-19 Thread Jay Sprenkle
On 1/19/06, manoj marathayil <[EMAIL PROTECTED]> wrote: > > hi, > is there is any way so that i can store the result > of > a select query and execute a delete query on the > same > table with out using any other buffer? How about: select id into temp_table from source_table where

[sqlite] store result

2006-01-19 Thread manoj marathayil
hi, is there is any way so that i can store the result of a select query and execute a delete query on the same table with out using any other buffer? T h a n k s & R e g a r d s , Manoj M | Webyog | Bangalore | Voice: 91 9886171984, 91 80 51216434(off) "A winner is not one who never fails,