Anyone up for a bit of a challenge? I have a query like the one below.
SELECT id, timeIn, timeOut, carType, limitTimeToCheckIn
FROM masterCarTable LEFT OUTER JOIN
carTypesTable ON masterCarTable.carType = carTypesTable.carType
timeIn is a datetime column
timeOut is a datetime column
carType is a string
limitTimeToCheckIn is a number of minutes, for example "15"
newColumn1 is timeIn plus minutes in limitTimeToCheckIn
newColumn2 this should contain a 1 or null - see below.
I would like to add 2 columns to check Select statement. First, I'd like a column that takes the timeIn time, and adds the number of minutes to it from the LimitTimeToCheckIn column. Next, if the total time in the new column is later than the timeOut column, I'd like to have a "1" appear in the 2nd new column. If timeOut is null, it should use "getdate()"
Is this possible? Thank you!