Re: [sqlite] Need help with query

2013-01-15 Thread Michael Black
You're structure is bad for future growth (i.e. multiple languages) as the query gets really nasty really quickly. You should normalize this data and your query will never change. pragma foreign_keys=ON; CREATE TABLE buttons ( ID integer primary key autoincrement, Key1 varchar no

Re: [sqlite] Need help with query

2013-01-14 Thread Kai Peters
On Tue, 15 Jan 2013 14:57:42 +0900, Yongil Jang wrote: > SELECT t1.key1, t1.key2, t2.description FROM MASTERLANGUAGES as t1, > MASTERLANGUAGES as t2 WHERE > t1.ISOCode = 'DEU' and t2.ISOCode = 'ENG' and t1.key1 = t2.key1 and t1.key2 = > t2.key2; that is very close - just needed to add t1.descrip

Re: [sqlite] Need help with query

2013-01-14 Thread Yongil Jang
like this? sqlite> SELECT t1.key1, t1.key2, t2.description FROM MASTERLANGUAGES as t1, MASTERLANGUAGES as t2 WHERE t1.ISOCode = 'DEU' and t2.ISOCode = 'ENG' and t1.key1 = t2.key1 and t1.key2 = t2.key2; FORM1|SAVE_BUTTON|Save FORM1|HELP_BUTTON|Help Sorry if my try is wrong. 2013/1/15 Kai Peters

Re: [sqlite] Need help with query optimization

2006-09-11 Thread Kervin L. Pierre
Hello Dennis, Jay, Thanks for you suggestions. The ids are simply returned to the calling application in a very large array. It's the API we're writing against; so we can't deviate from that unfortunately. Thanks for clarifying the INSERT trigger behavior. I'll try your suggestions and see wha

Re: [sqlite] Need help with query optimization

2006-09-11 Thread Dennis Cote
Kervin L. Pierre wrote: I'd appreciate any help or pointers optimizing the SQL in the main loop. for( 'large number' ){ // query1 "SELECT id FROM table WHERE attr1 = 'a', attr2 = 'b', ..." if( 'query1 returns no rows' ){ if( 'create flag is on' ){ // query2

Re: [sqlite] Need help with query optimization

2006-09-11 Thread Jay Sprenkle
On 9/11/06, Kervin L. Pierre <[EMAIL PROTECTED]> wrote: Basically, for every iteration we check that an id exists ( ie. 'query1' ), if it does we use it. But if the id does not exist we insert a row ( ie. 'query2' ), then get the 'last_insert_rowid' (ie. 'query3' ) and use that. SQL works bes