Title: Feature: Support Union · Issue #30 · sql2builder/sql2builder.github.io · GitHub
Open Graph Title: Feature: Support Union · Issue #30 · sql2builder/sql2builder.github.io
X Title: Feature: Support Union · Issue #30 · sql2builder/sql2builder.github.io
Description: This request is to add a feature for SQL Unions. Laravel Docs: Laravel Eloquent Unions MySQL Docs: MySQL 8.1 UNION Clause Union Example Example SQL input: (select * from `users` where `last_name` is null) union (select * from `users` whe...
Open Graph Description: This request is to add a feature for SQL Unions. Laravel Docs: Laravel Eloquent Unions MySQL Docs: MySQL 8.1 UNION Clause Union Example Example SQL input: (select * from `users` where `last_name` i...
X Description: This request is to add a feature for SQL Unions. Laravel Docs: Laravel Eloquent Unions MySQL Docs: MySQL 8.1 UNION Clause Union Example Example SQL input: (select * from `users` where `last_name` i...
Opengraph URL: https://github.com/sql2builder/sql2builder.github.io/issues/30
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature: Support Union","articleBody":"This request is to add a feature for SQL Unions.\r\n\r\n\r\nLaravel Docs: [Laravel Eloquent Unions](https://laravel.com/docs/10.x/queries#unions)\r\nMySQL Docs: [MySQL 8.1 UNION Clause](https://dev.mysql.com/doc/refman/8.1/en/union.html)\r\n\r\n\r\n## Union Example\r\nExample SQL input:\r\n```\r\n(select * from `users` where `last_name` is null) union (select * from `users` where `first_name` is null)\r\n```\r\n\r\nExample Eloquent output:\r\n```\r\nDB::table('users')\r\n-\u003ewhereNull('last_name')\r\n-\u003eunion(\r\n DB::table('users')\r\n -\u003ewhereNull('first_name')\r\n)\r\n-\u003eget();\r\n```\r\n\r\n## Union All Example\r\n\r\nExample SQL input:\r\n```\r\n(select * from `users` where `last_name` is null) union all (select * from `users` where `first_name` is null)\r\n```\r\n\r\nExample Eloquent output:\r\n```\r\nDB::table('users')\r\n-\u003ewhereNull('last_name')\r\n-\u003eunionAll(\r\n DB::table('users')\r\n -\u003ewhereNull('first_name')\r\n)\r\n-\u003eget();\r\n```\r\n\r\n## Union with orderBy on id\r\n\r\nExample SQL input:\r\n```\r\n(select * from `users` where `last_name` is null) \r\nunion\r\n(select * from `users` where `first_name` is null) \r\norder by `id` asc\r\n```\r\n\r\nExample Eloquent output:\r\n```\r\nDB::table('users')\r\n-\u003ewhereNull('last_name')\r\n-\u003eunionAll(\r\n DB::table('users')\r\n -\u003ewhereNull('first_name')\r\n)\r\n-\u003eorderBy('id')\r\n-\u003eget();\r\n```\r\n\r\n## Additional Context\r\nWhile Eloquent doesn't handle returning a UNION from multiple models well (everything will be shoved into the first model's class), it does handle it well as a subselect with multiple models. It makes it much easier to scan across many different models as part of a very complex where.","author":{"url":"https://github.com/kassah","@type":"Person","name":"kassah"},"datePublished":"2023-10-23T17:21:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/30/sql2builder.github.io/issues/30"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4e87e8c1-a8ea-8f8b-3b9e-3c6cd9818d9d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 81EA:2B1BC5:34A7CE:4848C9:69774BF2 |
| html-safe-nonce | 47d2083b732a5696a180377ea9eabe3f0b7bdfc3c40ef6130f73f4dfefdf1ca5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MUVBOjJCMUJDNTozNEE3Q0U6NDg0OEM5OjY5Nzc0QkYyIiwidmlzaXRvcl9pZCI6IjQwNzQ4Nzg4MTk3NDE2ODI2NzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 13d621baee2eb80c8cb9fed03d463ed218e2eb791748b7794664f291bbdbcbde |
| hovercard-subject-tag | issue:1957644270 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sql2builder/sql2builder.github.io/30/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9b121c7fc54b2afe18bb8398c220688644bee7940d4adbe17b82f7c3c2e00c79/sql2builder/sql2builder.github.io/issues/30 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9b121c7fc54b2afe18bb8398c220688644bee7940d4adbe17b82f7c3c2e00c79/sql2builder/sql2builder.github.io/issues/30 |
| og:image:alt | This request is to add a feature for SQL Unions. Laravel Docs: Laravel Eloquent Unions MySQL Docs: MySQL 8.1 UNION Clause Union Example Example SQL input: (select * from `users` where `last_name` i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kassah |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01d198479908d09a841b2febe8eb105a81af2af7d81830960fe0971e1f4adc09 |
| turbo-cache-control | no-preview |
| go-import | github.com/sql2builder/sql2builder.github.io git https://github.com/sql2builder/sql2builder.github.io.git |
| octolytics-dimension-user_id | 57521923 |
| octolytics-dimension-user_login | sql2builder |
| octolytics-dimension-repository_id | 220430244 |
| octolytics-dimension-repository_nwo | sql2builder/sql2builder.github.io |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 220430244 |
| octolytics-dimension-repository_network_root_nwo | sql2builder/sql2builder.github.io |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d37e99eca9fba24ee37da98481d573461cc1ab7d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width