File tree Expand file tree Collapse file tree
user_guide_src/source/database/query_builder Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?php
22
3- $ union = $ this ->db ->table ('users ' )->select ('id ' , 'name ' );
4- $ builder = $ this ->db ->table ('users ' )->select ('id ' , 'name ' );
5-
6- $ builder ->union ($ union )->limit (10 )->get ();
3+ $ builder = $ db ->table ('users ' )->select ('id, name ' )->limit (10 );
4+ $ union = $ db ->table ('groups ' )->select ('id, name ' );
5+ $ builder ->union ($ union )->get ();
76/*
87 * Produces:
98 * SELECT * FROM (SELECT `id`, `name` FROM `users` LIMIT 10) uwrp0
10- * UNION SELECT * FROM (SELECT `id`, `name` FROM `users `) uwrp1
9+ * UNION SELECT * FROM (SELECT `id`, `name` FROM `groups `) uwrp1
1110 */
Original file line number Diff line number Diff line change 11<?php
22
3- $ union = $ this -> db ->table ('users ' )->select ('id ' , ' name ' )->orderBy ('id ' , 'DESC ' )->limit (5 );
4- $ builder = $ this -> db ->table ('users ' )->select ('id ' , ' name ' )->orderBy ('id ' , 'ASC ' )->limit (5 )->union ($ union );
3+ $ union = $ db ->table ('users ' )->select ('id, name ' )->orderBy ('id ' , 'DESC ' )->limit (5 );
4+ $ builder = $ db ->table ('users ' )->select ('id, name ' )->orderBy ('id ' , 'ASC ' )->limit (5 )->union ($ union );
55
6- $ this -> db ->newQuery ()->fromSubquery ($ builder , 'q ' )->orderBy ('id ' , 'DESC ' )->get ();
6+ $ db ->newQuery ()->fromSubquery ($ builder , 'q ' )->orderBy ('id ' , 'DESC ' )->get ();
77/*
88 * Produces:
99 * SELECT * FROM (
You can’t perform that action at this time.
0 commit comments