Skip to content
Wouter Demuynck edited this page May 15, 2016 · 1 revision

Popsql also supports generating UNION statements. Consider the following code:

var suppliers = new SqlTable("Supplier", "s");
var customers = new SqlTable("Customer", "c");
var actual = Sql
    .Union(
        Sql.Select(suppliers + "City").From(suppliers),
        Sql.Select(customers + "City").From(customers))
    .ToSql();

which results in the following SQL:

(SELECT [s].[City] FROM [Supplier] [s]) 
UNION 
(SELECT [c].[City] FROM [Customer] [c])
Clone this wiki locally