Kaup, Chester
Chester_Kaup at kindermorgan.com
Thu Jan 3 09:41:20 CST 2013
The following query is giving me an error in from clause message. It highlights the > in the where statement. The subquery works ok on its own. What am I missing? Thanks. SELECT t1.PID, Left([t1.PID],10) AS API10, t1.Completion_Name, WellStatus([Status]) AS StatusShort, CDate(Int([StatusDate])) AS Status_Date FROM dbo_DSS_StatusChanges AS t1 INNER JOIN (SELECT DISTINCT PID, CDate(INT(StatusDate)), min(StatusDate) AS lastdatetime FROM dbo_DSS_StatusChanges WHERE t1.StatusDate)>CDate([Allocation_Stats]![DateLast_S] GROUP BY PID, CDate(INT(StatusDate))) AS t2 ON (t1.PID = t2.PID) AND (t1.StatusDate = t2.lastdatetime);