I have problems executing:
$result = DB::table("SRO_VT_LOG.dbo._LogEventChar AS c with(NOLOCK)")
->select('l.CharID, DATEDIFF(MINUTE, l.EventTime, GETDATE()) MinutesOnline, l.EventTime OnlineSince, COUNT(1) OVER (PARTITION BY c.EventID) AS OnlineCount')
->join(DB::raw('(SELECT CharID, MAX(EventTime) EventTime FROM SRO_VT_LOG.dbo._LogEventChar with(NOLOCK) WHERE EventID in (4, 6) GROUP BY CharID) AS l'),
function($join)
{
$join->on('c.EventTime', '=', 'l.EventTime')
->on('c.CharID', '=', 'l.CharID')
;
})
->get();
Error I encountered, i use laravel version 5.5, sql server 2014
SQLSTATE[42S22]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid column name 'CharID, DATEDIFF(MINUTE, l'. (42S22)
SQLSTATE[42S22]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid column name 'CharID, DATEDIFF(MINUTE, l'. (42S22)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire