hmmm, yes based on that i have come up with a simple sub-select approach:
select * from SELECT DailyMileageID, MileageAtStartOfShift, MileageAtEndOfShift, MileageAtEndOfShift - MileageAtStartOfShift AS DayMileage, MileageAtEndOfShift -
FROM dbo.DailyMileages AS I
WHERE (DailyMileageID = b.DailyMileageID + 1)) AS NightMileage, ShopID, DateEntered
FROM dbo.DailyMileages AS b
which works, but i am a little bothered about performance, but yes, thanks for the tip :
next task... convince this company to upgrade their sql server
Knock Knock, Who's There?, sp underscore, sp underscore who?
spid1, spid2, spid3....