Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

Linq ke SQL menggunakan grup Dengan, dan pesan berdasarkan hitungan

Coba ini:

var product = 
            from p in yourContext.Active_Details
            group p by p.PVersion into pgroup
            let count = pgroup.Count()
            orderby count
            select new { Count = count, PVersion = pgroup.Key };

SELECT count(ProductVersion), ProductVersion , ProductID , SubProductID 
FROM [do-not-delete-accounts].[dbo].[Activation_Details] 
group by ProductVersion,ProductID,SubProductID 
order by count(ProductVersion);

var query = 
            from p in yourContext.Activation_Details
            group p by new 
            { 
               ProductVersion = p.ProductVersion, 
               ProductID = p.ProductID,
               SubProductID = p.SubProductID 
            } 
            into pgroup
            let count = pgroup.Count()
            orderby count
            select new 
            { 
                Count = count, 
                ProductVersion = pgroup.Key.ProductVersion, 
                ProductID = pgroup.Key.ProductID,
                SubProductID = pgroup.Key.SubProductID  
            };


  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Masukkan data ke tabel mySQL dengan java

  2. MySQL - Perbarui banyak nilai dan WHERE IN

  3. MySQL Entity Framework 4.0 Pemetaan Bidang Prosedur Tersimpan

  4. Cara memperbarui grafik menggunakan matplotlib

  5. Mysql mengecualikan catatan