Check if this works: on a.Id equals c.OeeMachine where b.Target_Date == c.StopReasonStart.Date
.
Or maybe: on new { a.Id, b.Target_Date } equals new { Id = c.OeeMachine, Target_Date = c.StopReasonStart.Date }
.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
This is my sql query.
SELECT [ID],[MachineName], b.Target_Date, b.Job_Name1, c.StopReasonStart, c.StopReasonEnd
FROM [OEEDashboard].[dbo].[Machine] a
left join AllMachines b
on a.ID = b.MachineID
left join OeeDetailsAll c
on a.ID =c.OeeMachine and b.Target_Date = CAST(c.StopReasonStart as date)
where b.Target_Date = '2023-10-05'
order by a.ID, c.StopReasonStart
How can I get the ef core to return this query, I tried this.
var emp = from a in _dbContext.Machines
join b in _dbContext.AllMachines
on a.Id equals b.MachineId
join c in _dbContext.OeeDetailsAlls
on a.Id equals c.OeeMachine
select new
{
EntA = a, EntB = b
};
but I am a bit lost on including the last ON condition in it . This specific line into the ef core query. Kindly help.
on a.ID =c.OeeMachine and b.Target_Date = CAST(c.StopReasonStart as date)
Check if this works: on a.Id equals c.OeeMachine where b.Target_Date == c.StopReasonStart.Date
.
Or maybe: on new { a.Id, b.Target_Date } equals new { Id = c.OeeMachine, Target_Date = c.StopReasonStart.Date }
.