当前位置:Gxlcms > PHP教程 > zend2.2dbselect使用例子_PHP教程

zend2.2dbselect使用例子_PHP教程

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


use
= ->from('foo' = ->from( TableIdentifier('foo', 'bar' = ->from(('f' => 'foo' = ->from(('f' => TableIdentifier('foo' = ->from('foo')->columns(('bar', 'baz' = ->from('foo')->columns(('bar' => 'baz' = ->from('foo')->columns(('bar' => 'baz', 'bam' = ->from('foo')->columns(('bar' => Expression('COUNT(some_column)' = ->from('foo')->columns(( Expression('COUNT(some_column) AS bar' = ->from('foo')->'(COUNT(?) + ?) AS ?', ('some_column', 5, 'bar'), (Expression::TYPE_IDENTIFIER, Expression::TYPE_VALUE, Expression:: 5); // // 'SELECT (COUNT("some_column") + \'5\') AS "bar" FROM "foo"'; // joins (plain) = ->from('foo')->('zac', 'm = n' = ->from('foo')->('zac', 'm = n', ('bar', 'baz' = ->from('foo')->('zac', 'm = n', ('bar', 'baz'), Select:: = ->from('foo')->('zac', 'm = n', ('BAR' => 'bar', 'BAZ' => 'baz' = ->from('foo')->(('b' => 'bar'), 'b.foo_id = foo.foo_id' = ->from('foo')->where('x = 5' = ->from('foo')->where(('x = ?' => 5 5); // // 'SELECT "foo".* FROM "foo" WHERE x = \'5\''; // group = ->from('foo')->group(('col1', 'col2' = ->from('foo')->group('col1')->group('col2' = ->from('foo')->group( Expression('DAY(?)', ('col1'), (Expression:: = ->from('foo')->having('x = 5' = ->from('foo')->having(('x = ?' => 5 5); // // 'SELECT "foo".* FROM "foo" HAVING x = \'5\''; // order = ->from('foo')->order('c1' = ->from('foo')->order(('c1', 'c2' = ->from('foo')->order(('c1' => 'DESC', 'c2' => 'Asc')); = ->from('foo')->order(('c1' => 'asc'))->order('c2 desc'); = ->from('foo')->limit(5 5); // // 'SELECT "foo".* FROM "foo" LIMIT \'5\''; // limit with offset = ->from('foo')->limit(5)->offset(10 5, 'offset' => 10); // // 'SELECT "foo".* FROM "foo" LIMIT \'5\' OFFSET \'10\''; // joins with a few keywords in the on clause = ->from('foo')->('zac', '(m = n AND c.x) BETWEEN x AND y.z' = ->from('foo')->order('c1.d2' = ->from('foo')->group('c1.d2' = ->from('foo')->('zac', Expression('(m = n AND c.x) BETWEEN x AND y.z' = ->from('bar')->where->like('y', '%Foo%' = ->from(('x' => = ->from('table')->columns(('*'))->where('c1' => , 'c2' => (1, 2, 3), \Zend\Db\Sql\Predicate\IsNotNull('c3' = ->from('table')->order( Expression('isnull(?) DESC', ('name'), (Expression::TYPE_IDENTIFIER)), 'name' = ->from('foo')->columns(())->('bar', 'm = n', ('thecount' => Expression("COUNT(*)" = ->from('foo'->('tableA', Predicate\Operator('id', '=', 1->('tableB', Predicate\Operator('id', '=', 2->('tableC', Predicate\PredicateSet( Predicate\Operator('id', '=', 3), Predicate\Operator('number', '>', 20 :join3part2'; // // 'SELECT "foo".*, "tableA".*, "tableB".*, "tableC".* FROM "foo" ' // 'INNER JOIN "tableA" ON "id" = \'1\' INNER JOIN "tableB" ON "id" = \'2\' ' // 'INNER JOIN "tableC" ON "id" = \'3\' AND "number" > \'20\'';

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440209.htmlTechArticleuse = -from('foo' = -from( TableIdentifier('foo', 'bar' = -from( ('f' = 'foo' = -from( ('f' = TableIdentifier('foo' = -from('foo')-columns( ('bar', 'baz' = -from('foo')-columns( ('...

人气教程排行