{"action":"opened","number":30,"pull_request":{"url":"https://api.github.com/repos/joomla-framework/database/pulls/30","id":44774756,"html_url":"https://github.com/joomla-framework/database/pull/30","diff_url":"https://github.com/joomla-framework/database/pull/30.diff","patch_url":"https://github.com/joomla-framework/database/pull/30.patch","issue_url":"https://api.github.com/repos/joomla-framework/database/issues/30","number":30,"state":"open","locked":false,"title":"Handle union in DatabaseQuery","user":{"login":"jbanety","id":1055330,"avatar_url":"https://avatars.githubusercontent.com/u/1055330?v=3","gravatar_id":"","url":"https://api.github.com/users/jbanety","html_url":"https://github.com/jbanety","followers_url":"https://api.github.com/users/jbanety/followers","following_url":"https://api.github.com/users/jbanety/following{/other_user}","gists_url":"https://api.github.com/users/jbanety/gists{/gist_id}","starred_url":"https://api.github.com/users/jbanety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbanety/subscriptions","organizations_url":"https://api.github.com/users/jbanety/orgs","repos_url":"https://api.github.com/users/jbanety/repos","events_url":"https://api.github.com/users/jbanety/events{/privacy}","received_events_url":"https://api.github.com/users/jbanety/received_events","type":"User","site_admin":false},"body":"Build UNION queries like this : \r\n\r\n```php\r\n$q1 = $db->getQuery(true);\r\n$q2 = $db->getQuery(true);\r\n$q2 = $db->getQuery(true);\r\n\r\n$q1->select('a.col1, a.col2, a.col3')\r\n   ->from('test1 AS a')\r\n   ->order('a.col1 ASC');\r\n   \r\n$q2->select('b.col1, b.col2, b.col3')\r\n   ->from('test2 as b')\r\n   ->order('b.col1 DESC');\r\n\r\n$q3->select('c.col1, c.col2, c.col3')\r\n   ->from('test3 as c');\r\n\r\n$q1->union($q2)->union($q3);\r\n```\r\n\r\nSQL output : \r\n```sql\r\n( SELECT a.col1, a.col2, a.col3 FROM test1 AS a ORDER BY a.col1 ASC) UNION ( SELECT b.col1, b.col2, b.col3 FROM test2 as b ORDER BY b.col1 DESC) UNION ( SELECT c.col1, c.col2, c.col3 FROM test3 as c)\r\n```","created_at":"2015-09-11T12:04:27Z","updated_at":"2015-09-11T12:04:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/joomla-framework/database/pulls/30/commits","review_comments_url":"https://api.github.com/repos/joomla-framework/database/pulls/30/comments","review_comment_url":"https://api.github.com/repos/joomla-framework/database/pulls/comments{/number}","comments_url":"https://api.github.com/repos/joomla-framework/database/issues/30/comments","statuses_url":"https://api.github.com/repos/joomla-framework/database/statuses/e73204c5cab40d82581c0d3e4d9883394b37056d","head":{"label":"jbanety:patch-1","ref":"patch-1","sha":"e73204c5cab40d82581c0d3e4d9883394b37056d","user":{"login":"jbanety","id":1055330,"avatar_url":"https://avatars.githubusercontent.com/u/1055330?v=3","gravatar_id":"","url":"https://api.github.com/users/jbanety","html_url":"https://github.com/jbanety","followers_url":"https://api.github.com/users/jbanety/followers","following_url":"https://api.github.com/users/jbanety/following{/other_user}","gists_url":"https://api.github.com/users/jbanety/gists{/gist_id}","starred_url":"https://api.github.com/users/jbanety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbanety/subscriptions","organizations_url":"https://api.github.com/users/jbanety/orgs","repos_url":"https://api.github.com/users/jbanety/repos","events_url":"https://api.github.com/users/jbanety/events{/privacy}","received_events_url":"https://api.github.com/users/jbanety/received_events","type":"User","site_admin":false},"repo":{"id":42305870,"name":"database","full_name":"jbanety/database","owner":{"login":"jbanety","id":1055330,"avatar_url":"https://avatars.githubusercontent.com/u/1055330?v=3","gravatar_id":"","url":"https://api.github.com/users/jbanety","html_url":"https://github.com/jbanety","followers_url":"https://api.github.com/users/jbanety/followers","following_url":"https://api.github.com/users/jbanety/following{/other_user}","gists_url":"https://api.github.com/users/jbanety/gists{/gist_id}","starred_url":"https://api.github.com/users/jbanety/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbanety/subscriptions","organizations_url":"https://api.github.com/users/jbanety/orgs","repos_url":"https://api.github.com/users/jbanety/repos","events_url":"https://api.github.com/users/jbanety/events{/privacy}","received_events_url":"https://api.github.com/users/jbanety/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jbanety/database","description":"Joomla Framework Database Package","fork":true,"url":"https://api.github.com/repos/jbanety/database","forks_url":"https://api.github.com/repos/jbanety/database/forks","keys_url":"https://api.github.com/repos/jbanety/database/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jbanety/database/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jbanety/database/teams","hooks_url":"https://api.github.com/repos/jbanety/database/hooks","issue_events_url":"https://api.github.com/repos/jbanety/database/issues/events{/number}","events_url":"https://api.github.com/repos/jbanety/database/events","assignees_url":"https://api.github.com/repos/jbanety/database/assignees{/user}","branches_url":"https://api.github.com/repos/jbanety/database/branches{/branch}","tags_url":"https://api.github.com/repos/jbanety/database/tags","blobs_url":"https://api.github.com/repos/jbanety/database/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jbanety/database/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jbanety/database/git/refs{/sha}","trees_url":"https://api.github.com/repos/jbanety/database/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jbanety/database/statuses/{sha}","languages_url":"https://api.github.com/repos/jbanety/database/languages","stargazers_url":"https://api.github.com/repos/jbanety/database/stargazers","contributors_url":"https://api.github.com/repos/jbanety/database/contributors","subscribers_url":"https://api.github.com/repos/jbanety/database/subscribers","subscription_url":"https://api.github.com/repos/jbanety/database/subscription","commits_url":"https://api.github.com/repos/jbanety/database/commits{/sha}","git_commits_url":"https://api.github.com/repos/jbanety/database/git/commits{/sha}","comments_url":"https://api.github.com/repos/jbanety/database/comments{/number}","issue_comment_url":"https://api.github.com/repos/jbanety/database/issues/comments{/number}","contents_url":"https://api.github.com/repos/jbanety/database/contents/{+path}","compare_url":"https://api.github.com/repos/jbanety/database/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jbanety/database/merges","archive_url":"https://api.github.com/repos/jbanety/database/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jbanety/database/downloads","issues_url":"https://api.github.com/repos/jbanety/database/issues{/number}","pulls_url":"https://api.github.com/repos/jbanety/database/pulls{/number}","milestones_url":"https://api.github.com/repos/jbanety/database/milestones{/number}","notifications_url":"https://api.github.com/repos/jbanety/database/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jbanety/database/labels{/name}","releases_url":"https://api.github.com/repos/jbanety/database/releases{/id}","created_at":"2015-09-11T11:57:55Z","updated_at":"2015-09-11T11:57:56Z","pushed_at":"2015-09-11T12:04:21Z","git_url":"git://github.com/jbanety/database.git","ssh_url":"git@github.com:jbanety/database.git","clone_url":"https://github.com/jbanety/database.git","svn_url":"https://github.com/jbanety/database","homepage":"","size":1201,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"joomla-framework:master","ref":"master","sha":"fe4b3e86208703561a28595e5bdff2e0f9b881d6","user":{"login":"joomla-framework","id":6124926,"avatar_url":"https://avatars.githubusercontent.com/u/6124926?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla-framework","html_url":"https://github.com/joomla-framework","followers_url":"https://api.github.com/users/joomla-framework/followers","following_url":"https://api.github.com/users/joomla-framework/following{/other_user}","gists_url":"https://api.github.com/users/joomla-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla-framework/subscriptions","organizations_url":"https://api.github.com/users/joomla-framework/orgs","repos_url":"https://api.github.com/users/joomla-framework/repos","events_url":"https://api.github.com/users/joomla-framework/events{/privacy}","received_events_url":"https://api.github.com/users/joomla-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":8385748,"name":"database","full_name":"joomla-framework/database","owner":{"login":"joomla-framework","id":6124926,"avatar_url":"https://avatars.githubusercontent.com/u/6124926?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla-framework","html_url":"https://github.com/joomla-framework","followers_url":"https://api.github.com/users/joomla-framework/followers","following_url":"https://api.github.com/users/joomla-framework/following{/other_user}","gists_url":"https://api.github.com/users/joomla-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla-framework/subscriptions","organizations_url":"https://api.github.com/users/joomla-framework/orgs","repos_url":"https://api.github.com/users/joomla-framework/repos","events_url":"https://api.github.com/users/joomla-framework/events{/privacy}","received_events_url":"https://api.github.com/users/joomla-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla-framework/database","description":"Joomla Framework Database Package","fork":false,"url":"https://api.github.com/repos/joomla-framework/database","forks_url":"https://api.github.com/repos/joomla-framework/database/forks","keys_url":"https://api.github.com/repos/joomla-framework/database/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla-framework/database/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla-framework/database/teams","hooks_url":"https://api.github.com/repos/joomla-framework/database/hooks","issue_events_url":"https://api.github.com/repos/joomla-framework/database/issues/events{/number}","events_url":"https://api.github.com/repos/joomla-framework/database/events","assignees_url":"https://api.github.com/repos/joomla-framework/database/assignees{/user}","branches_url":"https://api.github.com/repos/joomla-framework/database/branches{/branch}","tags_url":"https://api.github.com/repos/joomla-framework/database/tags","blobs_url":"https://api.github.com/repos/joomla-framework/database/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla-framework/database/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla-framework/database/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla-framework/database/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla-framework/database/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla-framework/database/languages","stargazers_url":"https://api.github.com/repos/joomla-framework/database/stargazers","contributors_url":"https://api.github.com/repos/joomla-framework/database/contributors","subscribers_url":"https://api.github.com/repos/joomla-framework/database/subscribers","subscription_url":"https://api.github.com/repos/joomla-framework/database/subscription","commits_url":"https://api.github.com/repos/joomla-framework/database/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla-framework/database/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla-framework/database/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla-framework/database/issues/comments{/number}","contents_url":"https://api.github.com/repos/joomla-framework/database/contents/{+path}","compare_url":"https://api.github.com/repos/joomla-framework/database/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla-framework/database/merges","archive_url":"https://api.github.com/repos/joomla-framework/database/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla-framework/database/downloads","issues_url":"https://api.github.com/repos/joomla-framework/database/issues{/number}","pulls_url":"https://api.github.com/repos/joomla-framework/database/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla-framework/database/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla-framework/database/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla-framework/database/labels{/name}","releases_url":"https://api.github.com/repos/joomla-framework/database/releases{/id}","created_at":"2013-02-24T03:17:45Z","updated_at":"2015-08-12T13:28:07Z","pushed_at":"2015-09-11T12:04:27Z","git_url":"git://github.com/joomla-framework/database.git","ssh_url":"git@github.com:joomla-framework/database.git","clone_url":"https://github.com/joomla-framework/database.git","svn_url":"https://github.com/joomla-framework/database","homepage":"","size":1201,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":9,"forks":9,"open_issues":9,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla-framework/database/pulls/30"},"html":{"href":"https://github.com/joomla-framework/database/pull/30"},"issue":{"href":"https://api.github.com/repos/joomla-framework/database/issues/30"},"comments":{"href":"https://api.github.com/repos/joomla-framework/database/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla-framework/database/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla-framework/database/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/joomla-framework/database/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/joomla-framework/database/statuses/e73204c5cab40d82581c0d3e4d9883394b37056d"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":11,"deletions":6,"changed_files":1}}