Top "Union" questions

Use this tag only for questions about UNION, a keyword of the SQL language for combining the results of multiple SQL queries.

UNION after ORDER BY and LIMIT

My goal is to execute two different queries and then combine them. My code is: SELECT * FROM some tables WHERE ... …

mysql sql sql-order-by union
SQL returns less results when using UNION?

I have a SQL Server stored procedure that doesn't give me all the results when I add in the union …

sql-server tsql union
MySQL - How to unpivot columns to rows?

I'm probably not seeing things very clear at this moment, but I have a table in MySQL which looks like …

mysql sql union unpivot lateral-join
Combine two sql select queries (in postgres) with LIMIT statement

I've got a table and I want a query that returns the last 10 records created plus the record who's id …

sql postgresql select limit union
apply "ORDER BY" on a "UNION" (Mysql)

Good Day. So, everythign is in the title :) I am looking to merge the result of two requests and order …

mysql sql-order-by union
ERROR: failed to find conversion function from unknown to text

There is an error on PostgreSQL that it gives on one of my select statements. I searched the web for …

sql postgresql types casting union
In SQL, a Join is actually an Intersection? And it is also a linkage or a "Sideway Union"?

I always thought of a Join in SQL as some kind of linkage between two tables. For example, select e.…

sql mysql join union intersection
Mysql UNION and GROUP BY

I have 2 tables I need to add together based on a date and 2 values. This gives me the list of …

mysql join group-by union
How to have a custom sort order for a union query in Postgres

With a query like this (simplified for clarity): SELECT 'East' AS name, * FROM events WHERE event_timestamp BETWEEN '2015-06…

postgresql sql-order-by union
SQLite3 Simulate RIGHT OUTER JOIN with LEFT JOINs and UNION

I have the following select statement where I need to sum each task from table tbTasks and group them by …

sql sqlite group-by union full-outer-join