Skip to content

Instantly share code, notes, and snippets.

@uyu423
Created July 18, 2016 19:13
Show Gist options
  • Save uyu423/bfa5a2867d0c90b1a441d3f5543239a7 to your computer and use it in GitHub Desktop.
Save uyu423/bfa5a2867d0c90b1a441d3f5543239a7 to your computer and use it in GitHub Desktop.
var qsb = require("node-qsb")
var qs = new qsb().select('myTable', 'MT')
.join('yourTable', 'YT')
.join('ourTable', 'OT')
.where('MT.idx', '=', 'YT.mIdx')
.where('YT.idx', '=', 'OT.yIdx')
.where('MT.idx', '<=', 10)
.whereOr('YT.idx', '<', 100)
.limit(0, 100)
.orderBy('MT.a', 'desc')
.build();
console.log(qs.returnString());
//SELECT * FROM `myTable` `MT` JOIN `yourTable` `YT` JOIN `ourTable` `OT` WHERE `MT`.`idx` = 'YT.mIdx' AND `YT`.`idx` = 'OT.yIdx' AND `MT`.`idx` <= '10' OR `YT`.`idx` < '100' ORDER BY `MT`.`a` desc LIMIT 0, 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment