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

And some sample data:

TABLEA
1|0|0|0
2|1|0|0
3|2|1|1
4|0|1|2
5|1|2|0
6|3|1|3

TABLEB, TABLEC, TABLED
1|A
2|B
3|C

The problem is that I need to grab rows from TABLEB where the ID of that row 
appears in TABLEA, at the same time satisfying other conditions such as IDC of 
that row also has multiple values (IDC=1 OR IDC=2, for example).

So, given:

IDC=1 AND (IDD=1 OR IDD=3)

I need to get rows 2 and 3 from TABLEB.

Hopefully this makes more sense :)

Best regards,

   Dennis

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

Reply via email to