I have the following Querry which works:
Declare @DateofPurchase as datetime
SELECT TOP 1 DateofPurchase
FROM Purchases
WHERE customerID = 75
ORDER BY DateofPurchase DESC
I would like to set @DateofPurchase = DateofPurchase from the above querry which returns only one row, but cannot figure out the syntax.
I know it is a simple task and a stupid question, however, any help would be appreciated.
Thanks in advance.
Declare @DateofPurchase as datetime
SELECT TOP 1 DateofPurchase
FROM Purchases
WHERE customerID = 75
ORDER BY DateofPurchase DESC
I would like to set @DateofPurchase = DateofPurchase from the above querry which returns only one row, but cannot figure out the syntax.
I know it is a simple task and a stupid question, however, any help would be appreciated.
Thanks in advance.