I want to convert this 100% working SQL Query into a Linq Query using Vb.net. Thanks
SELECT
TOP (100) PERCENT Level3.L2_ID,
DATEDIFF(day, Level3.ACT_DATE, BaseLine.ACT_DATE) AS Diff,
CASE WHEN datediff(day, Level3.ACT_Date, Baseline.ACT_Date) >0 THEN 1 END AS Green
FROM Level3
INNER JOIN BaseLine
ON Level3.L3_ID = BaseLine.L3_ID
I first tried the following code in LinqPad (as a vb Expression) and it is working
From l In Level3s
Join a In Baselines
On l.L3_ID Equals a.L3_ID
Select
Activity = (l.L2_ID) ,
Diff = (a.ACT_DATE.day-l.Act_Date.day)
but does not work when I add
Green = if (a.ACT_DATE.day-l.Act_Date.day) >= 0, 1 end if
What is the correct syntax for this.
From l In Level3s
Join a In Baselines
On l.L3_ID Equals a.L3_ID
Select
Activity = (l.L2_ID) ,
Diff = (a.ACT_DATE.day-l.Act_Date.day),
Green = if (a.ACT_DATE.day-l.Act_Date.day) >= 0, 1 end if