• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.