This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, I'm having a problem with a LINQ join. The join compares both the month and year of a DateTime with the month and year of another DateTime. The problem I'm having is that the generated SQL compares the two DateTimes directly instead of using DATEPART to compare the month and year of the DateTimes. Here's the C# LINQ: (note the join)
Here's the resulting SQL executed against our MS SQL db: (note the first inner join)
If I convert the LINQ into a C# expression for LINQPad it generates the following SQL, which uses DATEPART for the join comparison:
Could you let me know if this is by-design / a bug / or user error? Thanks for your help, Alex (edited to fix typo) |
|
|
This looks like a bug - I will have a look into why this isn't translating out to use that function.
|
|
|
Just as a follow up to this, we dont currently support functions on join criteria which is why this isnt being translated so for now Im afraid its not possible to express this and Ive added an item to our backlog to look at adding this in.
|
|
|
Hi Jeremy, thanks for investigating this further and keeping us in the loop with the follow-up. Cheers, Alex |
|