Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok. It turns out to be the problem with MySQL. I'm using Entity Framework's query, that later turns into db specific SQL. I this case MySQL. So, the query in EF is:</p> <pre><code>var query3a = from TGosc gosc in context.TGosc where gosc.TRezerwacja .Any(x =&gt; x.TPlatnosc .Any(y =&gt; y.Kwota &gt; 100000)) select new { gosc.IdGosc, gosc.TOsoba.Imie, gosc.TOsoba.Nazwisko }; </code></pre> <p>Now, the provider in my app is Connector NET 6.7.4. It includes MySQL.Data and MySQL.Data.Entities, both in version 6.7.4.</p> <p>However, I also installed MySQL for Visual Studio 1.0.2 to be able to use more GUI than code in Visual Studio. But this thing comes with same dlls, just in different (older) versions 6.6.5. And these took precedence over the newer ones when application was running. (It's weird in the first place that in the same MySQL Installer there are two somehow conflicting versions of the same dlls.)</p> <p>Anyway, I removed MySQL for Visual Studio 1.0.2, which left me with the newer dlls and see what happens to the very same LINQ to Entities query, when it's being translated to db sql:</p> <pre class="lang-sql prettyprint-override"><code>--old 6.6.5 SELECT Extent1.IdGosc, Extent2.Imie, Extent2.Nazwisko FROM TGosc AS Extent1 INNER JOIN TOsoba AS Extent2 ON Extent1.IdGosc = Extent2.IdOsoba WHERE EXISTS( SELECT 1 AS C1 FROM ( SELECT Extent3.IdRezerwacja FROM TRezerwacja AS Extent3 WHERE Extent1.IdGosc = Extent3.IdGosc) AS Project1 WHERE EXISTS( SELECT 1 AS C1 FROM TPlatnosc AS Extent4 WHERE (Project1.IdRezerwacja = Extent4.IdRezerwacja) AND (Extent4.Kwota &gt; 100000))) </code></pre> <p>vs</p> <pre class="lang-sql prettyprint-override"><code>-- new 6.7.4 SELECT Extent1.IdGosc, Extent2.Imie, Extent2.Nazwisko FROM TGosc AS Extent1 INNER JOIN TOsoba AS Extent2 ON Extent1.IdGosc = Extent2.IdOsoba WHERE EXISTS( SELECT 1 AS C1 FROM TRezerwacja AS Project1 WHERE EXISTS( SELECT 1 AS C1 FROM TPlatnosc AS Extent4 WHERE (Project1.IdRezerwacja = Extent4.IdRezerwacja) AND (Extent4.Kwota &gt; 100000)) AND Extent1.IdGosc = Project1.IdGosc) </code></pre> <p>It's similar to what Gordon Linoff answered in this post. The middle subquery dissapears. And of course the new query works fine!</p> <p>Summing up, I guess the MySQL provider for .NET got better over these versions. I still have some queries that cause similar problems but now I think I know why that is - provider. I'm ok with that.</p> <p>The annoying thing is that there are two different versions of dlls, one overriding another, in MySQL Installer. I'm using mysql-installer-community-5.6.13.0.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload