I am trying to put together an MSSQL query together but failing miserably as I normally write SQL server syntax.
WITH daily_events (xSerial,xIDCard,xStart,zDuration) AS
(select re.REU_TgtID_Char, at.id_card, from_unixtime(re.reu_startsec), re.reu_durationsec
from recorded_events_uwb re Inner Join assigned_tags at On re.REU_TgtID_Char=at.serial_asc
order by 2,3)
select rt.RT_TagID_Char, at.id_card, at.serial_asc , from_unixtime(at.timestamp), from_unixtime(rl.rol_timestamp)
from recorded_tags rt Inner Join assigned_tags at On rt.RT_TagID_Char=at.serial_asc
inner join readout_log rl On rl.ROL_RT_ID=rt.RT_ID
Left Outer Join assigned_tags at1 On at1.serial_asc= daily_events.xSerial;
I think the issue is with the cte statement any help would be greatly appreciated.