Welcome Guest, Not a member yet? Register   Sign In
Nested selects with Active Record
#1

[eluser]dangermark[/eluser]
Hi all,

Is it possible to do nested select queries in Active Record?

Something that would generate:

Code:
SELECT * FROM table1 WHERE id IN (SELECT id FROM table2)

If it's not possible, an idea (or link) on the best way to accomplish this in CI would be great.

Thanks for your time.
#2

[eluser]seeraw[/eluser]
You can use instead

$this->db->query(‘YOUR NESTED QUERY HERE’);

Thanks,
Swapnil
#3

[eluser]InsiteFX[/eluser]
Or maybe a join!

InsiteFX
#4

[eluser]dangermark[/eluser]
[quote author="seeraw" date="1299067960"]You can use instead

$this->db->query(‘YOUR NESTED QUERY HERE’);

Thanks,
Swapnil[/quote]

Cool, that'll work fine, just wasn't sure if there was another way.




Theme © iAndrew 2016 - Forum software by © MyBB