2015-11-14T22:11:45.001-05:00 error vpxd[05056] [Originator@6876 sub=StatsAggregator opID=29966d1e] [VpxdStatsAggregator::QueryCounterMetric] "ODBC error: (42000) - [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon." is returned when executing SQL statement "SELECT SC.ENTITY_ID, SM.SAMPLE_TIME, ST.STAT_VAL FROM VPX_STAT_COUNTER SC WITH (NOLOCK), VPX_SAMPLE_TIME1 SM WITH (NOLOCK), VPX_DEVICE D WITH (NOLOCK), (SELECT * FROM VPX_HIST_STAT1 WITH (NOLOCK)) ST WITH (NOLOCK) WHERE SM.SAMPLE_TIME >= ? AND SM.SAMPLE_TIME <= ? AND ST.TIME_ID = SM.TIME_ID AND SC.STAT_ID = ? AND COALESCE(D.DEVICE_NAME, N'') = N'' AND SC.ENTITY_ID IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,"
Any idea how to fix or troubleshoot this?
Database is MS SQL 2014