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.

ORDER BY with a UNION of disparate datasets (T-SQL)

I have a query that UNION's two somewhat similar datasets, but they both have some columns that are not present …

sql sql-server tsql join union
Combine two SELECT queries in PostgreSQL

I would like to combine two select queries with UNION. How can I use the result from the first SELECT …

sql postgresql union common-table-expression
Order by clause with Union in Sql Server

I want List of party names with 1st option as 'All' from database. but i won't insert 'All' to Database, …

sql sql-server sql-order-by union
Column names for a table formed by a UNION

Given a couple of simple tables like so: create table R(foo text); create table S(bar text); If I …

sql sqlite union
SQL: Using Top 1 in UNION query with Order By

I have a table as below Rate Effective_Date ---- -------------- 5.6 02/02/2009 5.8 05/01/2009 5.4 06/01/2009 5.8 12/01/2009 6.0 03/15/2009 I am supposed to find the all rates that …

sql-server sql-order-by union
Couldnt identify equality operator of type json[] when using UNION

I'm trying to perform multiple queries on a single table using a UNION rule I have two tables: project (id, …

json postgresql union
SQL Server UNION - What is the default ORDER BY Behaviour

If I have a few UNION Statements as a contrived example: SELECT * FROM xxx WHERE z = 1 UNION SELECT * FROM xxx …

sql sql-server union sql-order-by
Are these two relations compatible for a union operation?

I'm not sure if the following two relations are compatible for a union: R: <- schema name B 1 2 2 3 3 And: …

database relational-database union relational-algebra
The data type text cannot be used as an operand to the UNION, INTERSECT or EXCEPT operators because it is not comparable

I have a table Id (PK) Owner int DescriptionText text which is joined to another table Id (FK) Participant int …

sql sql-server tsql union
performance of union versus union all

I have to run a select statement across several tables. I am sure the tables return different records. I am …

sql-server performance union union-all