-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
JOIN on Query #451
Comments
You can simply pass the table name as string, var query = new Query("Sales")
.Join("Items", j => j.On("Sales.Item", "Items.Item")); Or even simpler without using the join lambda var query = new Query("Sales")
.Join("Items", "Sales.Item", "Items.Item"); since the join condition is simple columns equality condition. Here is a live example https://sqlkata.com/playground?code=var%20query%20%3D%20new%20Query(%22Sales%22)%0A%20%20%20%20.Join(%22Items%22%2C%20j%20%3D%3E%20j.On(%22Sales.Item%22%2C%20%22Items.Item%22))%3B |
Thanks for the response. In reality I should have started my previous post with a big thanks to you, SqlKata is really a great tool and I really appreciate the work you did and that you open sourced it! To better phrase my question, I am using SqlKata within my project and I am wrapping my objects (whether EF models etc.) in there respective types, hence I made all my "tables" create a This is not really an issue as It might 100% be that I need to rethink the design of my little project, but I was more wondering whether there is a way in SqlKata to do it. Once again thank you for this great tool! |
Reopening this issue as a PR was created to help me solve my issue. |
I was wondering wether there is a way to
JOIN
on aQuery
which just defines aFROM
(noSELECT
s etc.).i.e.
Here is the sample SQL I am aiming to get
However, my code is equivalent to
which results in the following SQL
my code considers all tables as
Query
s which only works for the"Sales"
table (as that is the initialQuery
), passing aQuery
containing only a table name results in theJoin
JOIN
ing on a subquery of the table passed...The text was updated successfully, but these errors were encountered: