Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Counts of two table base on dates using linq

$
0
0

I have two tables Registers and IAApplications as below

Registers

NameEmailCreationdateMazharKhan@gmail.com              2018-09-0213:08:32.303
mohan                                 m@gmail.com                 2018-09-0113:08:32.303
kjdj                                  k@gmail.com                 2018-09-0113:08:32.303

IAApplications

TitleSectorSubmissionDate
 kk                     jj                  2018-09-0313:08:32.303
 kk                     jj                  2018-09-0213:08:32.303
 mm                     tt                  2018-09-0113:08:32.303

I need below ouput for my report

DateNewRegistratioNewApplication09-03-20180109-02-20181109-01-201821

I tried below code getting wrong data

varRegs=from o in db.Registersselectnew{ A =(o.Creationdate)};varApps=from c in db.IAApplicationsselectnew{ A =(c.SubmissionDate)};var result =(from x inRegs.Concat(Apps)group x by x.A into ogselectnew{Date= og.Key,Reg= og.Count(),App= og.Count()}).ToList();

I am getting wrong result as below image in my local system i have lot of data but not mention above table question.

enter image description here

I know some thing wrong in my query that's why date is not showing group by and also data counts

I have prefer this example

Linq - Group by multiple tables

Thank you in advance.


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>