assert.Equal(t,query,`((SELECT table1.col1 AS "table1.col1" FROM db.table1) UNION (SELECT table2.col3 AS "table2.col3" FROM db.table2))`)
assert.Equal(t,len(args),0)
}
funcTestUnionThreeSelect(t*testing.T){
query,args,err:=UNION(
table1.SELECT(table1Col1),
table2.SELECT(table2Col3),
table3.SELECT(table3Col1),
).Sql()
assert.NilError(t,err)
assert.Equal(t,query,`((SELECT table1.col1 AS "table1.col1" FROM db.table1) UNION (SELECT table2.col3 AS "table2.col3" FROM db.table2) UNION (SELECT table3.col1 AS "table3.col1" FROM db.table3))`)
assert.Equal(t,len(args),0)
}
funcTestUnionWithOrderBy(t*testing.T){
query,args,err:=UNION(
table1.SELECT(table1Col1),
table2.SELECT(table2Col3),
).ORDER_BY(table1Col1.Asc()).Sql()
assert.NilError(t,err)
assert.Equal(t,query,`((SELECT table1.col1 AS "table1.col1" FROM db.table1) UNION (SELECT table2.col3 AS "table2.col3" FROM db.table2)) ORDER BY table1.col1 ASC`)
assert.Equal(t,len(args),0)
}
funcTestUnionWithLimit(t*testing.T){
query,args,err:=UNION(
table1.SELECT(table1Col1),
table2.SELECT(table2Col3),
).LIMIT(10).OFFSET(11).Sql()
assert.NilError(t,err)
assert.Equal(t,query,`((SELECT table1.col1 AS "table1.col1" FROM db.table1) UNION (SELECT table2.col3 AS "table2.col3" FROM db.table2)) LIMIT $1 OFFSET $2`)