loopbackio / loopbackio/loopback-next
How to perform joins on non-primary columns and complex select statements in loopback 4?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
Describe the bug
Hi i am new to loopback and need to create an API with business logic that contains several complex queries. I cant seem to find a way to join two tables with non-primary columns. For example, select * from e_c left join e on e.ed=e_c.ed Table relations: e_c.ed fk to ed table on id e.ed fk to ed table on id
On the same note writing complex select statements are also needed. For example, select (case when completed_on is null then 1 else 0 end) flag from e or select sum(rating) from f_b
Kindly provide some method by which these can be achieved via loopback 4
Logs
No response
Additional information
No response
Reproduction
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file, test, or entry point is named. Start by reviewing LoopBack 4 relation and query APIs against the non-primary-column join and complex SELECT examples; done means identifying a documented supported approach or clearly documenting the limitation and required scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100