jet/mysql/set_statement_test.go

34 lines
589 B
Go
Raw Normal View History

2019-08-11 12:13:59 +02:00
package mysql
import (
"testing"
)
func TestSelectSets(t *testing.T) {
select1 := SELECT(table1ColBool).FROM(table1)
select2 := SELECT(table2ColBool).FROM(table2)
2019-08-12 12:11:16 +02:00
assertStatementSql(t, select1.UNION(select2), `
2019-08-11 12:13:59 +02:00
(
SELECT table1.col_bool AS "table1.col_bool"
FROM db.table1
)
UNION
(
SELECT table2.col_bool AS "table2.col_bool"
FROM db.table2
);
`)
2019-08-12 12:11:16 +02:00
assertStatementSql(t, select1.UNION_ALL(select2), `
2019-08-11 12:13:59 +02:00
(
SELECT table1.col_bool AS "table1.col_bool"
FROM db.table1
)
UNION ALL
(
SELECT table2.col_bool AS "table2.col_bool"
FROM db.table2
);
`)
}