当前位置:Gxlcms > 数据库问题 > 3.2 Zend_Db_Select

3.2 Zend_Db_Select

时间:2021-07-01 10:21:17 帮助过:17人阅读

php // 首先,一个简单的 "LIMIT :count" $select = $db->select(); $select->from(‘foo‘, ‘*‘); $select->order(‘id‘); $select->limit(10); // // 在mysql/psotgreSql/SQLite,能够得到这种语句: // // SELECT * FROM foo // ORDER BY id ASC // LIMIT 10 // // 可是在Microsoft SQL下,能够得到这种语句: // // SELECT TOP 10 * FROM FOO // ORDER BY id ASC // // // 如今, 是更复杂的 "LIMIT :count OFFSET :offset"方法 $select = $db->select(); $select->from(‘foo‘, ‘*‘); $select->order(‘id‘); $select->limit(10, 20); // // 在mysql/psotgreSql/SQLite,能够得到这种语句: // // SELECT * FROM foo // ORDER BY id ASC // LIMIT 10 OFFSET 20 // // 可是在Microsoft SQL下,由于不支持偏移量功能,能够得到这样sql语句: // // SELECT * FROM ( // SELECT TOP 10 * FROM ( // SELECT TOP 30 * FROM foo ORDER BY id DESC // ) ORDER BY id ASC // ) // // Zend_Db_Adapter 能够自己主动的完毕sql语句的动态创建. // ?

>


10.4.9. 通过页数和总数进行LIMIT限制
技术分享

3.2 Zend_Db_Select

标签:使用   ber   img   proc   type   3.2   ack   mysq   offset   

人气教程排行