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 );
> CREATE TABLE TABLED ( ID INTEGER PRIMARY KEY, DATA );


> What I'm trying to achieve is something like the following:
>
> SELECT * FROM TABLEB WHERE ID IN ( SELECT IDB AS ID FROM TABLEA LEFT  
> JOIN TABLEB ON IDB=1 )
>
> But I also need to add additional constraints from TABLEC and TABLED  
> to narrow down the results. Basically, I only want results from  
> TABLEA with a given set of IDB, IDC and IDD (there could be multiple  
> of each of course).

You do not refer to your DATA columns in your SELECT command.  All you  
are doing is SELECTing on your IDs.  So can you explain why you can't  
use

SELECT * FROM TABLEB WHERE IDB = "xxx" AND IDC = "yyy" AND IDD = "zzz"

?

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to