This repository has been archived on 2024-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
smart-tag/db/selectDB.js

22 lines
584 B
JavaScript

const con = require('./connect')
function select(collectionFk, callback){
let consSql = `SELECT t.id AS Ticket, c.name AS Client, am.name AS Agency, tc.level AS Level, tc.wagon AS Wagon
FROM ticketCollection tc
JOIN ticket t ON t.id = tc.ticketFk JOIN client c ON t.clientFk = c.id
JOIN agencyMode am ON am.id = t.agencyModeFk
WHERE tc.collectionFk = ${collectionFk}
ORDER BY tc.wagon, tc.level`;
con.con.query(consSql, function (err, result, fields) {
console.log(result);
callback(null,result);
});
}
exports.select =select;