1
私はknexと、次のSQLを実行したい複数のテーブルから選択しますか?Knexは
私はknexと、次のSQLを実行したい複数のテーブルから選択しますか?Knexは
knexは、union
およびunionAll
をサポートしています。それが文書化されています
knex.select().from(function() {
this.select().from('foo')
.unionAll(function() {
this.select().from('bar')
}).as('biz')
}).limit(10).offset(20).toString()
出力:
select * from (select * from `foo` union all select * from `bar`) as `biz` limit 10 offset 20