Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

union-all

Curious issue with Oracle UNION and ORDER BY

January 9, 2024 by Tarik

This doesn’t really answer the question, but it seems to be a parser bug (or ‘feature’) rather than a language requirement. According to My Oracle Support, this seems to have been raised as bug 14196463 but closed with no resolution. It’s also mentioned in community thread 3561546. You need a MOS account, or at least … Read more

Categories sql Tags oracle, oracle11g, sql, sql-order-by, union-all Leave a comment

How to execute UNION without sorting? (SQL)

September 9, 2023 by Tarik

I notice this question gets quite a lot of views so I’ll first address a question you didn’t ask! Regarding the title. To achieve a “Sql Union All with “distinct”” then simply replace UNION ALL with UNION. This has the effect of removing duplicates. For your specific question, given the clarification “The first query should … Read more

Categories sql Tags distinct, sql, union, union-all Leave a comment

How can I do a Union all in Entity Framework LINQ To Entities?

August 6, 2023 by Tarik

Here is the answer you are looking for. Use the Concat keyword. From the example: var query = (from x in db.Table1 select new {A = x.A, B = x.B}) .Concat( from y in db.Table2 select new {A = y.A, B = y.B} );

Categories c# Tags c++, entity-framework-4, linq, tsql, union-all Leave a comment

Combining ORDER BY AND UNION in SQL Server

April 4, 2023 by Tarik

Put your order by and top statements into sub-queries: select first.Id, first.Name from ( select top 1 * from Locations order by Id) first union all select last.Id, last.Name from ( select top 1 * from Locations order by Id desc) last

Categories sql Tags sql, sql-order-by, sql-server, union-all Leave a comment

What is the difference between UNION and UNION ALL?

August 28, 2022 by Tarik

UNION removes duplicate records (where all columns in the results are the same), UNION ALL does not. There is a performance hit when using UNION instead of UNION ALL, since the database server must do additional work to remove the duplicate rows, but usually you do not want the duplicates (especially when developing reports). To … Read more

Categories sql Tags sql, union, union-all Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa