I am making a MySQL query where I want to get the identifier, but only if I find a match for it on all the lines that I specified in the query.
Table: view_layout_rows ID owner rows ___________________ 49 1 2 50 1 2 Table: view_layout_rows_columns ID row columns ___________________ 49 1 5 49 2 4 50 1 5 50 2 5 SELECT vlr.id FROM view_layout_rows vlr INNER JOIN view_layout_rows_columns vlrc ON vlr.id = vlrc.id WHERE vlr.rows = 2 AND (vlr.owner = 0 OR vlr.owner = 1)
And all the following conditions must be met:
(vlrc.row = 1 AND vlrc.columns = 5) (vlrc.row = 2 AND vlrc.columns = 5)
Only the identifier 50 needs to be returned. 49 must NOT be returned, since it satisfies only one of the last two sentences.
How can i do this? (Please note that I asked this question earlier, but my requirement was unclear. Second attempt.) Thank you in advance for any suggestions.
source share