dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

union in dresende/node-orm2 #754

Closed nilist closed 5 years ago

nilist commented 7 years ago

I would like to union two table while querying. like this: SELECT tbl1.name FROM tbl1 UNION ALL SELECT tbl2.name FROM tbl2 ORDER BY name LIMIT 10, 10; Is there any other API to achieve this except driver.execQuery. @dresende

nilist commented 7 years ago

Another way I got is operating the tow collection of the query or find API, like this

Tbl1.all(function(err, ds1) {
    if (err) throw err;
    Tbl2.all(function(err, ds2) {
        if (err) throw err;
        operate ds1 and ds2... ...
    });
});

Using some module like async will make it beautiful.