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 Support, Below is a linq query I have written in VB.Net Dim unallocated = (From referral In _uow.FraudReferrals Here is a copy of the associated sql (for Sql Server) which lightspeed has generated. SELECT g1.REPORT_CODE
SELECT t0.REFERRAL_ID AS [t0.REFERRAL_ID], As you can see from above lightspeed had generated two queries instead of just one, both queries use a cross join and the second query brings back all the columns instead of just a REPORT_CODE and a COUNT. I'm pretty new to linq so I've probably structured the query incorrectly but i would have like the query to generate something similar to: SELECT t0.REPORT_CODE AS [REPORT_CODE], I'd appreciate any help you could give me. |
|
|
Hi Oliver, The cross join comes from the use of FRAUD_REFERRAL in the nested select where it isnt aware of its usage in the outer query. Thanks for raising this, this is something we can look at adding in as a post processing optimization so I have added a ticket to our backlog for this and we can let you know when this is added in. Unfortunately the way you are writing the query at the moment there isnt really an opportunity to tweak how this would work, however if you are able to restructure the query to explicitely join FRAUD_PERMISSION to FRAUD_REFERRAL in the inner query that should resolve it, I imagine this will be slightly less optimal than the query you have expressed above but still a marked improvement over a cross join :)
Jeremy |
|