Skip to content
Advertisement

Tag: knex.js

many to many relationship knex js

I am trying to fetch data from the database in this way: I want all the templates and those templates have an array of categories in it so the methode I am currently using currently I am doing this but the object doesn’t seem to alter. Answer You are not waiting for the promises to resolve. You should do: instead

Knex join on column belonging to same same table

Using Knex.js, I am attempting to query a table of users. The only columns that are important for this scenario are internal_id (key), name, and supervisor_id. Every user (except one) has a supervisor and their record stored the ID of that supervisor. When viewing an individual user record in my app, I want to query the users table getting info

Relational database created/stored on client [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 5 months ago. Improve this question I’m in the early stages of designing an Electron application that

Convert Raw SQL to Bookshelf/Knex

I’m trying to convert a simple raw SQL to use Bookshelf/Knex in JavaScript: Original SQL: select * from o where o.id = 1 or o.id = 2 and (o.is_a = true or o.is_b = true) and o.status = ‘good’; I’ve tried to rewrite it in multiple ways using .orWhere .andWhere but cannot get the same result that I get from

Combine two columns and perform a where operation on the result

I have two columns, one for ‘firstName’ and one for ‘lastName’. I’m trying to perform a where operation on the concatenation of those two columns to match for a full name. Here is what I’ve tried: This just returns a blank array. Example Data: firstName lastName Clayton Smith Barbara Clayman Sam Peterson when some_value = Clay, it should return ‘Clayton

(SQL) Pulling linked profiles from two tables using Knex

I currently have two tables with the following data: I currently have my query set up like this with Knex: I’m currently parsing the data into the following format: This works totally fine except for the cases where the parent has no children, as it won’t pull any data at all, including parent info. Is there any workaround in this

Advertisement