Hi, this subquery works in SQL Server 2005 Compact Edition 4
SELECT TableA.serialNo
FROM TableA,
(SELECT MAX(TableB.lotNo) AS lotNo,TableA.codeA,TableA.codeB
FROM TableA, TableB
WHERE (TableA.codeA =TableB.codeA)
AND (TableA.codeB = TableB.codeB)
AND ((LEN(TableA.openDate) > 0) OR TableA.openDate IS NOT NULL)
GROUP BY
TableA.codeA, TableA.codeB) a
WHERE (TableA.lotNo < a.lotNo)
AND (TableA.codeA = a.codeA)
AND (TableA.codeB = a.codeB)
AND ((LEN(TableA.endDate) = 0) OR TableA.endDate IS NULL)
How can It be made in SQL Server 2005 Compact Edition 3.1?
Thanks!