How does C-sharp LINQ implement queries like left join and right join in SQL with method syntax?

how does C-sharp LINQ implement queries like left join and right join in SQL with method syntax?

May.21,2022

..


GroupJoin

right join is to write the right table on the left


//inner join
from a in StoreInCities
join b in CityInfo on a.CityId equals b.ID into c
select c

//left join   (right join)
from a in StoreInCities
join b in CityInfo on a.CityId equals b.ID into c
//DefaultIfEmpty()DefaultIfEmpty()inner join
from d in c.DefaultIfEmpty()
select d

//left join
StoreInCities
   .GroupJoin (
      CityInfo, 
      a => a.CityId, 
      b => b.ID, 
      (a, c) => 
         new  
         {
            a = a, 
            c = c
         }
   )
   .SelectMany (
      temp0 => temp0.c.DefaultIfEmpty (), 
      (temp0, d) => d
   )


//sqllinglinglinqpad
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bca1be-12f11.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bca1be-12f11.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?