mardi 26 juillet 2016

Using MIN in where clause

Trying to change the following code to allow me to use min in where clause

SELECT od.personID
,'Uno' AS [CustomerType]
FROM dbo.orderDetails od
WHERE od.orderDate BETWEEN CONVERT(date, '2016-02-01') AND @StartDate
AND MIN(odd.orderDate) BETWEEN CONVERT(date, '2016-02-01') AND @StartDate)
GROUP BY personID

Aucun commentaire:

Enregistrer un commentaire