mysql - Relation can not contain other values than in array -


i'm struggling , hope can me out bit.

let's have 2 tables: class , student. 1 class has many students , student has 1 class.

i allowed manage students, spread out on different classes. retrieve classes allowed see. based on, may see class when students in visibility (which given through array). instead of in need all in, doesn't exist.

does 1 can point me right direction, how achieve doctrine v1.2.4 or plain sql?

i've been struggling queries , came solution, retrieve classes students within visibility:

select     c.*     class c inner join student s on c.id = s.class_id     s.id not in (         select             id                     student                     s.id not in (1, 2, 5, 6, 8) /* visible student id's */ ) group     c.id 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -