Monday 19 November 2018

Need some help.

I'm working on an API and am hitting a stumbling block. I can find individual items in my database by ID and I can select all items, but I need to find all items with a specific identifier.My find all is structured like so :findAll() {let sqlRequest = "SELECT * FROM item";return this.common.findAll(sqlRequest).then(rows => {let items = [];for (const row of rows) {items.push(new Item(row.id, row.name, row.quantity, row.bin));}return items;});};My find by id:findById(id) {let sqlRequest = "SELECT id, name, quantity, bin FROM item WHERE id=$id";let sqlParams = {$id: id};return this.common.findOne(sqlRequest, sqlParams).then(row =>new Item(row.id, row.name, row.quantity, row.bin));};​But what I am looking for is to find all items that have the same bin. Any help would be greatly appreciated.

Submitted November 19, 2018 at 05:57PM by gwizard202q

No comments:

Post a Comment