I'm trying to convert a sql server query to sqlite but I'm at a stuck point. Just wondering what else I'm missing here?
SQL Server Query :
select tblWorkers.nClientWorkerID , nWorkerFirstname, nworkerlastname,
isnull(nWorkerSuffix,'') as nWorkerSuffix, nWorkerPhone, nTitle
, CurrentStatus, CurrentColor from tblworkers
left join tblTitles on tblWorkers.iTitleID = tblTitles.ititleid
left join (select top 1 nClientWorkerID, iNewStatusID, nStatusShort as CurrentStatus, nStatusColor as CurrentColor
from tblTimeLog
join tblTimeStatuses TSS on TSS.iTimeStatusID = tblTimeLog.iNewStatusID
where tblTimeLog.iEDLID =
isnull((select cast(nvalue as int) from tblElectionSettings where nKey='CurrentEDL'),0)
order by tblTimeLog.dCreationDate desc ) tLog
on tLog.nClientWorkerID = tblWorkers.nClientWorkerID
where tblWorkers.nClientWorkerID = 'CW1'
SQLite query :
select tblWorkers.nClientWorkerID , nWorkerFirstname, nworkerlastname, ifnull(nWorkerSuffix,'') as nWorkerSuffix, nWorkerPhone, nTitle
, CurrentStatus, CurrentColor from tblworkers
left join tblTitles on tblWorkers.iTitleID = tblTitles.ititleid
left join (select top 1 nClientWorkerID, iNewStatusID, nStatusShort as CurrentStatus, nStatusColor as CurrentColor
from tblTimeLog
join tblTimeStatuses TSS on TSS.iTimeStatusID = tblTimeLog.iNewStatusID
where tblTimeLog.iEDLID =
ifnull((select cast(nvalue as int) from tblElectionSettings where nKey='CurrentEDL'),0)
order by tblTimeLog.dCreationDate desc ) tLog
on tLog.nClientWorkerID = tblWorkers.nClientWorkerID
where tblWorkers.nClientWorkerID = 'CW1'
I'm erroring out at the same line as SELECT TOP 1. I know Top 1 can be replaced with LIMIT 1 but where would the LIMIT 1 go? and what else am I missing?
Aucun commentaire:
Enregistrer un commentaire