0

does anyone know how to do a nested query such as "SELECT * FROM (SELECT * FROM table LIMIT 0,12) table ORDER BY rand ()", using Zend_Db_Table?

  • Maybe this help: http://stackoverflow.com/questions/1340564/writing-a-subquery-using-zend-db –  Feb 20 '14 at 21:01

1 Answers1

0

It is not supported in direct way. You can try some workarounds, but still the best way will be to get db adapter and query manually like:

$db = Zend_Db_Table::getDefaultAdapter();
$db->query('SELECT * FROM (SELECT * FROM table LIMIT 0,12) table ORDER BY rand ()');

If you want try workarounds like creating 2 queries and mixing them, passing subquery as ->from() part etc. have a look at this topic Zend_Db_Table subquery

Community
  • 1
  • 1
MSadura
  • 1,032
  • 13
  • 18