我有这个查询:
Select VENDOR, CODE, TABOF.OFID,DATEI,DATEF,VARR,VARRT,DESEXT
from (
Select A_IND,A_COD,A_DES,A_FX,A_ML,
OFID,DATEI,DATEF,VARR,VARRT,FLAGD,VENDOR
from ANTAB
join TABOF
on (ANTAB.A_COD = TABOF.VENDOR)
where
A_FX <> '' and A_ML <> '' and
A_DES <> '' and A_COD <> '' and
A_IND <> '' and
A_FX < (47.7 + 0.5) and
A_FX > (47.7 - 0.5) and
A_ML < (15.5 + 0.5) and
A_ML > (15.5 - 0.5)
order by
sqrt(power((A_FX - 47.7),2) +
power((A_ML - 15.5),2))
limit 1
)
join OF_MNTAB
on (OF_MNTAB.OFID = OFTAB.OFID)
where
DATEI <= getdate() and
DATEF >= getdate() and
OFTAB.FLAGD = 0 and
CODE not in ('MANU','TRAN') and
VENDOR = A_COD
order by DATEI desc
但是当我尝试执行它时它一直给我错误:“限制”附近的语法错误,如果我删除限制选项,它会在下一行的连接附近给我语法错误..我是一个 sql noob,这是一个复杂的查询对我来说..我做错了什么?