Re: [sqlite] Asking for SQL statement help

2009-09-08 Thread Dennis Volodomanov
> SELECT * FROM TABLEB WHERE ID IN ( > SELECT IDB FROM TABLEA WHERE IDC = 1 AND IDD IN (1, 3) > ) Yes, I think you are right - I'll do some extensive testing of course, but it looks good logically. Thank you! Dennis ___ sqlite-users mailing

Re: [sqlite] Asking for SQL statement help

2009-09-08 Thread P Kishor
On Tue, Sep 8, 2009 at 12:58 AM, Dennis Volodomanov wrote: > Thank you for the quick replies and sorry for not being too clear. > > I will try to state the problem more clearly, without my own attempts to > solve it, as they are incorrect anyway. > > The simplified schemas

Re: [sqlite] Asking for SQL statement help

2009-09-07 Thread Dennis Volodomanov
Thank you for the quick replies and sorry for not being too clear. I will try to state the problem more clearly, without my own attempts to solve it, as they are incorrect anyway. The simplified schemas again: CREATE TABLE TABLEA ( ID INTEGER PRIMARY KEY, IDB INTEGER, IDC INTEGER, IDD INTEGER

Re: [sqlite] Asking for SQL statement help

2009-09-07 Thread Simon Slavin
On 8 Sep 2009, at 6:31am, Dennis Volodomanov wrote: > Let's say we've got 4 tables: > > CREATE TABLE TABLEA ( ID INTEGER PRIMARY KEY, IDB INTEGER, IDC > INTEGER, IDD INTEGER ); > CREATE TABLE TABLEB ( ID INTEGER PRIMARY KEY, DATA ); > CREATE TABLE TABLEC ( ID INTEGER PRIMARY KEY, DATA ); >

Re: [sqlite] Asking for SQL statement help

2009-09-07 Thread P Kishor
On Tue, Sep 8, 2009 at 12:31 AM, Dennis Volodomanov wrote: > Hello all, > > A small SQL problem, no doubt, for experts here. > > Let's say we've got 4 tables: > > CREATE TABLE TABLEA ( ID INTEGER PRIMARY KEY, IDB INTEGER, IDC INTEGER, IDD > INTEGER ); > CREATE TABLE TABLEB (

Re: [sqlite] Asking for SQL statement help

2009-09-07 Thread Darren Duncan
Dennis Volodomanov wrote: > SELECT * FROM TABLEB WHERE ID IN ( SELECT IDB AS ID FROM TABLEA LEFT JOIN > TABLEB ON IDB=1 ) First of all, "IDB=1" isn't a join condition; it doesn't compare a column from TABLEA with a column from TABLEB. Did you mean to say "WHERE" rather than "ON"? In which

[sqlite] Asking for SQL statement help

2009-09-07 Thread Dennis Volodomanov
Hello all, A small SQL problem, no doubt, for experts here. Let's say we've got 4 tables: CREATE TABLE TABLEA ( ID INTEGER PRIMARY KEY, IDB INTEGER, IDC INTEGER, IDD INTEGER ); CREATE TABLE TABLEB ( ID INTEGER PRIMARY KEY, DATA ); CREATE TABLE TABLEC ( ID INTEGER PRIMARY KEY, DATA ); CREATE