There was an SQL error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'cine107.streams.id' which is not in SELECT list; this is incompatible with DISTINCT - SELECT DISTINCT `member_id` FROM (`streams`) WHERE `product_id` IN (3540,9188) ORDER BY `id` DESC