re: [sqlite] Query locking up SQLite

2005-08-10 Thread David Fowler
David Fowler wrote: Query 2: SELECT * FROM table1, table2 WHERE ((table1.value LIKE "%value%" AND table1.table2_id = table2.id) > OR (table1.value LIKE "%different_value%" AND table1.table2_id = table2.id)); This query (and even more complex versions of it) works in MySQL (Haven't tried

re: [sqlite] Query locking up SQLite

2005-08-03 Thread Khamis Abuelkomboz
David Fowler wrote: Query 2: SELECT * FROM table1, table2 WHERE ((table1.value LIKE "%value%" AND table1.table2_id = table2.id) > OR (table1.value LIKE "%different_value%" AND table1.table2_id = table2.id)); This query (and even more complex versions of it) works in MySQL (Haven't tried

Re: [sqlite] Query locking up SQLite

2005-07-26 Thread K. Haley
Try using UNION instead of OR. Several posts have mentioned that OR can dissable the use of an index. You're also right about table order being important, there's information on the wiki about this. I would guess that the best order is table3, table5, table4, table2, table1 since you're

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
> SQLite Version 3.2.2. > Is this a bug, or is my SQL that bad? > Query 1: > SELECT * FROM table1, table2 > WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id); > This query works perfectly, can't fault it. > But when I do this, SQLite locks out (Command line interface, and PHP5)

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread Jay Sprenkle
> SQLite Version 3.2.2. > Is this a bug, or is my SQL that bad? > Query 1: > SELECT * FROM table1, table2 > WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id); > This query works perfectly, can't fault it. > But when I do this, SQLite locks out (Command line interface, and PHP5)

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
Might I suggest the following -- make your query in steps, and note where it actually starts slowing down. For example, Step 1. SELECT COUNT(*) FROM t1 (took a fraction of a pico second... good) Step 2. SELECT COUNT(*) FROM t1 WHERE t1.c1 = 'c1' (took a couple of fractions of a pico

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread Puneet Kishor
On Jul 25, 2005, at 6:06 AM, David Fowler wrote: On 2005-07-25 at 10:58:04 [+0200], David Fowler .. === Thanks for the pointer Charlie, but I was only using * for my example, and I normaly use fully named columns (table.column) when writing

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
I think if you try this with MySQL MyISAM you will have the same result and I think this is to do with the SELECT * I remember I used to have something similar back in the days when I tried MySQL. Charlie == I just tried adding extra conditions in

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread Charlie Clark
On 2005-07-25 at 14:51:13 [+0200], David Fowler <[EMAIL PROTECTED]> wrote: > Well the query isn't that strange, I have 3 values that need matching > per-record returned, all in different tables (takes care of 3 tables) the > actual data I want is stored in another related table, and 2 of the

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
On 2005-07-25 at 13:06:42 [+0200], David Fowler <[EMAIL PROTECTED]> wrote: > SELECT count(*) FROM table1 > INNER JOIN table2 ON (table1.id = table2.rel_id) > INNER JOIN table3 ON (table3.rel_id = table2.id) > INNER JOIN table4 ON (table3.id = table4.rel_id) > INNER JOIN table5 ON (table5.rel_id

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread Charlie Clark
On 2005-07-25 at 13:06:42 [+0200], David Fowler <[EMAIL PROTECTED]> wrote: > SELECT count(*) FROM table1 > INNER JOIN table2 ON (table1.id = table2.rel_id) > INNER JOIN table3 ON (table3.rel_id = table2.id) > INNER JOIN table4 ON (table3.id = table4.rel_id) > INNER JOIN table5 ON (table5.rel_id

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
On 2005-07-25 at 10:58:04 [+0200], David Fowler <[EMAIL PROTECTED]> wrote: > Thanks Charlie, thats exactly how I should be doing it. I would imagine > there are some performance benefits from doing it this way too. Now I've > just got to make it work for my select that involves six not two

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread Charlie Clark
On 2005-07-25 at 10:58:04 [+0200], David Fowler <[EMAIL PROTECTED]> wrote: > Thanks Charlie, thats exactly how I should be doing it. I would imagine > there are some performance benefits from doing it this way too. Now I've > just got to make it work for my select that involves six not two

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
On 2005-07-25 at 10:15:14 [+0200], David Fowler <[EMAIL PROTECTED]> wrote: > SELECT * FROM table1, table2 > WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id); > This query works perfectly, can't fault it. > But when I do this, SQLite locks

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread Charlie Clark
On 2005-07-25 at 10:15:14 [+0200], David Fowler <[EMAIL PROTECTED]> wrote: > SELECT * FROM table1, table2 > WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id); > This query works perfectly, can't fault it. > But when I do this, SQLite locks out (Command line interface, and

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
this statement has an extra ; which may be the error. Another thought, when quoting string literals, it is better to use single quotes('), since double quotes(") means identifier --column name-- first, string literal second. John == Thanks for the very

Re: [sqlite] Query locking up SQLite

2005-07-25 Thread John LeSueur
David Fowler wrote: SQLite Version 3.2.2. Is this a bug, or is my SQL that bad? Query 1: SELECT * FROM table1, table2 WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id); This query works perfectly, can't fault it. But when I do this, SQLite locks out (Command line interface,

[sqlite] Query locking up SQLite

2005-07-25 Thread David Fowler
SQLite Version 3.2.2. Is this a bug, or is my SQL that bad? Query 1: SELECT * FROM table1, table2 WHERE (table1.value LIKE "%value%" AND table1.table2_id = table2.id); This query works perfectly, can't fault it. But when I do this, SQLite locks out (Command line interface, and PHP5) Query 2: