[eluser]ThatDaveCarter[/eluser]
Hi,
I'm currently executing a query using $this->db->query($sql,$data), which has worked fine for me so far, however the query now needs some adjustments, and needs to contain a subquery. I'm having trouble figuring out a way to do this, and was wondering what the best way to do this in CI would be.
My current MySQL query reads similar to this:
Code:
SELECT * FROM `table` where `forename` like '%%' AND `surname` like '%%'
I need to update it to this:
Code:
SELECT * FROM `table` where (`forename` like '%%' AND `surname` like '%%') OR userid in ((select userid from `genres` where `genre` like '%genre1%' or `genre` like '%genre2%'))
The Genres part of this query will be dynamic, depending on input from a HTML form (an array of items is posted)
I've tried numerous iterations that I can think of, to no avail. My head is fried right now.. Any tips/guidance please?
Regards,
Dave