外部应用到 MS ACCESS
OUTER APPLY to MS ACCESS
如何将此代码 (sql) 转换为 ms 访问:
SELECT *
FROM dbo.Movimiento m
OUTER APPLY ( SELECT TOP 1
costo
FROM dbo.Unitario u
WHERE u.Cod = m.Cod
AND u.Fecha <= m.Fecha
ORDER BY u.Fecha DESC) u
您可以使用相关子查询:
SELECT m.*,
(SELECT TOP 1 costo
FROM dbo.Unitario as u
WHERE u.Cod = m.Cod AND
u.Fecha <= m.Fecha
ORDER BY u.Fecha DESC
) as costo
FROM dbo.Movimiento as m;
如何将此代码 (sql) 转换为 ms 访问:
SELECT *
FROM dbo.Movimiento m
OUTER APPLY ( SELECT TOP 1
costo
FROM dbo.Unitario u
WHERE u.Cod = m.Cod
AND u.Fecha <= m.Fecha
ORDER BY u.Fecha DESC) u
您可以使用相关子查询:
SELECT m.*,
(SELECT TOP 1 costo
FROM dbo.Unitario as u
WHERE u.Cod = m.Cod AND
u.Fecha <= m.Fecha
ORDER BY u.Fecha DESC
) as costo
FROM dbo.Movimiento as m;