'SQL MIN with convert Function as Military time
This Works Perfectly, but returns the latest time...
CONVERT(nvarchar(10), dbo.UDO_VW_LocalPanelTime.DATE, 108) AS Q_Event_Time,
How do i get it for the First instance. Right now it shows the Last Instance. i believe a min function is needed...i could be wrong...Kinda new to SQL...Learning the ways of the force...
eg 11:52, 13:03, 15:15, 17:00
The Code above returns 17:00, I need it to return 11:52
Can anyone provide an updated code for this please?
Here is the Pre CODE:
CREATE VIEW UDO_VW_LocalPanelTime
AS
SELECT dbo.EVENTS.EMPID,
CASE WHEN (EVENT_TIME_UTC > DST_Start_CurrentYear AND EVENT_TIME_UTC < DST_End_CurrentYear)
THEN
DATEADD(MI,GMTOFFSET - DAYLIGHTBIAS, EVENT_TIME_UTC) ELSE DATEADD(MI, GMTOFFSET, EVENT_TIME_UTC) END AS DATE,
dbo.EVENTS.MACHINE,
dbo.EVENTS.CARDNUM, dbo.EVENTS.DEVID
FROM dbo.EVENTS INNER JOIN
dbo.READER ON dbo.EVENTS.DEVID = dbo.READER.READERID AND dbo.EVENTS.MACHINE = dbo.READER.PANELID INNER JOIN
dbo.UDO_WV_PanelPlusDST ON dbo.READER.PANELID = dbo.UDO_WV_PanelPlusDST.PANELID
GO
Thank you so much for your time!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
