question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

shall use leftJoin by default and support on clause

See original GitHub issue

https://github.com/nestjsx/crud/blob/35acb442c62cdebea7fd33f5c1e9cf1dec31d539/packages/crud-typeorm/src/typeorm-crud.service.ts#L335-L344

shall use leftJoin by default and use innerJoin by config see sequelize options include.required behavior

If the relation can be set NULL, innerJoin will break the query.

refer: http://docs.sequelizejs.com/class/lib/model.js~Model.html#static-method-findAll

Name Type Attribute Description
options.include[].required boolean optional If true, converts to an inner join, which means that the parent model will only be loaded if it has any matching children. True if include.where is set, false otherwise.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
michaelyalicommented, Jul 1, 2019

@Diluka @macchie this will have a high priority on the next release.

5reactions
Dilukacommented, Jun 13, 2019
export type QueryJoin = {
  field: string;
  select?: QueryFields;
  required?: boolean; // <-- add here?
  on?: string; // <-- maybe this together?
};

You do this PR is better. I need to take the time to familiarize myself with this new architecture.

When using left join and the relation can be set null, the same condition put in on or where can be different result.

p.s. I feel that it will become more and more complicated here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL Join clause introduction and overview - SQLShack
If you just specify Join, then by default it is an Inner join; An Outer join must be Left/Right/Full. You cannot just say...
Read more >
SQL JOIN - WHERE clause vs. ON clause - Stack Overflow
For INNER JOIN the answer is yes since an INNER JOIN statement can be rewritten as a CROSS JOIN with a WHERE clause...
Read more >
Understanding MySQL LEFT JOIN Clause By Examples
In other words, LEFT JOIN returns all rows from the left table regardless of whether a row from the left table has a...
Read more >
LEFT JOIN, RIGHT JOIN operations (Microsoft Access SQL)
Left outer joins include all of the records from the first (left) of two tables, even if there are no matching values for...
Read more >
JOIN clause
That means that only rows for which the join condition is TRUE are included. If you do not specify the join type, JOIN...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found