grouping with remote grouping for join not working
See original GitHub issueHello,
I am using LinqToDb as database framework (if you use it you don’t want to use EF again 😃 ). Everything works fine for a normal query with a dx-grid. Buit if I try to create a left join query and access the header filter, the created query will fail.
This is my join:
var r = from k in this.GetTable<Person>() join ks in this.GetTable<Student>() on new Tuple<int, string>(k.Id, k.Number.ToString()) equals
new Tuple<int, string>(ks.Id, ks.Number) into joinedTable
from g in joinedTable.DefaultIfEmpty()
select new Person(k) {
IsBlocked = (k.StatusBitmask & 0x80) != 0, IsBlockedStudent = (g.StatusBitmask & 0x80) != 0 };
The reault in the grid works perfect:
[HttpGet]
[Route("with-filter")]
public HttpResponseMessage GetFiltered( [FromUri]DataSourceLoadOptions loadOptions)
{
LoadResult result = null;
try
{
loadOptions.RemoteSelect = true;
loadOptions.RequireTotalCount = true;
using(var db = DbContext())
{
// Get joined result will retrieve the joined query.
result = DataSourceLoader.Load(db.GetJoinedResult(), loadOptions);
}
}
catch (Exception ex)
{
return new HttpResponseMessage(HttpStatusCode.InternalServerError);
}
return Request.CreateResponse(result);
}
The resulting sql is the following:
-- Firebird
SELECT
Count(*) as c1,
0 as c2
FROM
PERSON k1
LEFT JOIN STUDENT joinedTable ON k1.ID = joinedTable.ID AND Cast(k1.NUMBER as VarChar(11) CHARACTER SET UNICODE_FSS) = joinedTable.NUMBER
ORDER BY
0
This does not work, because the order by is not valid. And I am not sure if this is the desired query?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Not able to use GROUP BY with join query in MySQL
1 Answer 1 ... You can not select all(* means all) columns from a table and do a group by one column. That...
Read more >Group By with Inner Joins. This is not working. : r/SQL
Hi Everyone, I am playing around with the group by clause to get a better understanding of how it works. I am working...
Read more >DataGrid - How to correctly setup remote grouping in ...
We have a problem with grouping in data grid. Remote grouping works if we set autoExpandGroup property to true for all columns.
Read more >How to Join a Window Covering to a Group - Hunter Douglas
View this video to learn more about programing your Hunter Douglas PowerView Pebble Remote and how to join a window covering to a...
Read more >Students can't join a group or topic
"Brand New Group" error: The group doesn't have topics yet. For students to join the discussion, educators must add a topic to the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Checked this with the guys at LinqToDb. It is the cause of using the copy constructor in the GetJoinedResult(), so the grouping had no data to group. Without using a copy constructor, but setting the properties directly in the select statement, this works. Thanks for your work!
Nit 100% sure, but this could be a linq2db bug.