-
Notifications
You must be signed in to change notification settings - Fork 50
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
[Question] Join a subquery #66
Comments
I believe this can be worked out without subquery: # You don't seem to use `payment` so I ommit it
Seat.joining { order_items.outer }.grouping { [id, order_items.orderable_id] }
.selecting { [sum(order_items.quantity * order_items.unit_price).as('amount'), 'seats.*'] } This requires |
Provided example is taken from the squeel readme for illustration purposes. I can't deny that many SQL queries can be transformed from subquery based to non-subquery based, but in many cases subquery is just easier to write. Would be awesome to have that ability / choice :) |
Yeah, I agree that it would be nice for baby squeel to provide this functionality, but I'm having trouble finding the time to add new features. I'd be thrilled to receive a pull request! |
First of all, that's an awesome gem and I'm super happy I found it 🔥 🔥 🔥
The "parent" gem (squeel) has an ability of joining a subquery, example from their readme:
I wonder if there's an ability to achieve the same thing with baby squeel?
The text was updated successfully, but these errors were encountered: