ktorm icon indicating copy to clipboard operation
ktorm copied to clipboard

Add support for subqueries

Open ashokgelal opened this issue 6 years ago • 1 comments

This request was hidden under another issue in this comment. I'm creating its own dedicated ticket.

From the comment:

I was doing some reading on how people solve this problem and came across this article that talks about how this could be achieved using just a single query and keeping it efficient as well using subqueries.

Although this article is written for PHP (and for Laravel framework), I think this could be added in ktorm as well. I found other examples online where subqueries make writing complex queries very intuitive and keeps it within ORM boundary.

Here is the article (you don't have to read the whole article if you don't want to, you can stop when it starts talking about macros but I highly recommend reading the whole thing as you might find a gem or two to add in ktorm): https://reinink.ca/articles/dynamic-relationships-in-laravel-using-subqueries

ashokgelal avatar Nov 08 '19 20:11 ashokgelal

We ran into this limitation today - subqueries seem common and important enough that I believe a fix should be prioritized. Is there any known difficulties that one should know about if attempting to implement it?

sigmanil avatar Jun 28 '21 11:06 sigmanil