-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nested tables on join #144
Comments
You can create raw queries using |
thanks! I wanted to create the join query in a hook, but setting |
I'm closing the issue, thanks for the quick response! If possible, does anyone have any suggestion regarding the best practice for these types of joins (as mentioned in my previous comment)? |
This is what works for me (full before hook example):
|
you can try like this:
|
Hi,
Using feathers-knex (postgresql), I am trying to nest my tables on a join. Here is an example on how to achieve this with node-postgres.
brianc/node-postgres#733
SELECT to_json(a.*) AS table1, to_json(b.*) AS table2 FROM some_table a LEFT JOIN another_table b ON a.id = b.id
;With this all rows will be structured as such:
{ table1: { ... },
table2: { ... } }
However, using:
const query = this.createQuery({ query: hook.params.query });
query.select(to_json(a.*) AS table1)
is giving me an error because it assumes that the table name is “to_json(a”. Is there a way to generate raw queries with feathers-knex?
The text was updated successfully, but these errors were encountered: