Click here to Skip to main content
15,896,359 members

Comments by spunnam (Top 2 by date)

spunnam 5-Jan-13 6:32am View    
Actually,I though that you want latest record irrespective of each customer.Thats why i used TOP(1),Which retrieves only one topest record.Try the following query for your requirement..
;WITH cte as
(
SELECT id,max(oSDate) AS latestStartDate
FROM tblOrder
group BY id
)

SELECT C.*,O.*
FROM tblCust AS C
LEFT JOIN tblOrder AS O on O.id =C.id
LEFT JOIN cte AS Temp on Temp.id = C.id
WHERE O.oSDate = Temp.latestStartDate
spunnam 4-Jan-13 8:43am View    
Actaully,What i want is i need to update the application object at 7am each day automatically.Is there any way in ASP.NET?