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 anoth
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 anoth
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 actuall
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 actuall
> 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)
> 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)
>
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 second.
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
quer
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 the
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 valu
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 =
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 =
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 tables!
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 tables
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 ou
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 PHP5)
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 fa
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, an
18 matches
Mail list logo