Hi,
I really dont know who to solve the follwing problem:
I got 3 tables: a, b, and a_b. a is the main table and b is a table with different flags. a_b is the habtm connection table.
Lets say I have a few entries in my flag table b and there are connected via the a_b.
Table a
ID | NAME
---------------------.
1 | first
2 | second
Table b
ID | NAME
-------------------.
1 | flag1
2 | flag2
3 | flag3
Table a_b
A_ID | B_ID
-----------------.
1 | 1
1 | 3
2 | 2
2 | 3
SO now I would like to select only entries from table a which have a flag1 and flag3 (so it should only return “first” from table a). MYSQL “IN” doesnt work here. How could I do this? My research only gave me this solution and I dont know how to implement it in cake: http://stackoverflow.com/questions/6121779/mysql-subset-operation