c# - Distinct LINQ by dateOfCreation -


i have diagram of database enter image description here

as can see, pipelinejobstatus aggregation - has 2 keys, first key can repeat itself:

pipelineid|jobstatusid

6 | 3

6 | 6

6 | 8

7 | 1

7 | 2

8 | 9

i want show same view (merge), latest createddatetime distinct values. linq:

  private iqueryable<statuspipelinemerge> wholeresults()     {         var query2 = (            pjs in db.pipelinejobstatus            pipe in db.pipelines                .where(pipe => pipe.pipelineid == pjs.pipelineid).defaultifempty()            status in db.jobstatus                .where(statuses => statuses.jobstatusid == pjs.jobstatusid).defaultifempty()            fco in db.fcoes                 .where(fcoes => fcoes.fcoid == pipe.fcoid)            client in db.clients            .where(clients => clients.clientid == pipe.clientid)            group new { pipe.createdtimestamp }           new           {               status.jobstatusname,               pipe.pipelineid,               pipe.clientid,               client.clientname,               fco.namefco,               fco.fcoid,               pipe.employee.name,               pipe.employee.surname,               pipe.commentpipeline,               pipe.createdby,               pipe.createdtimestamp,               pipe.modifiedtimestamp,               pipe.projectvaluehr,               pipe.projectvaluemoney           } g             orderby g.key.pipelineid ascending             select new statuspipelinemerge            {                 pipelineid = g.key.pipelineid                ,                projectvaluehr = g.key.projectvaluehr                ,                projectvaluemoney = g.key.projectvaluemoney                ,                commentpipeline = g.key.commentpipeline                ,                clientname = g.key.clientname                ,                fconame = g.key.namefco                ,                fcoid = g.key.fcoid                ,                clientid = g.key.clientid                ,                createdtimestamp = g.key.createdtimestamp                ,                modifiedtimestamp = g.key.modifiedtimestamp                ,                createdby = g.key.createdby                ,                //creatednamesurname = g.key.employee.name + " " + g.key.employee.surname                 jobstatusname = g.key.jobstatusname            }              );          return (query2);     } 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -