I have a table (SQLJobStatus) with a column (Job_Date) that has date/time records. (2014-02-07 23:30:00.000)
I am trying to get all records from last night at 11:30pm (23:30:00) until now.
select * from SQLJobStatus where ((Job_Date >= (DATEADD(d,-1,GETDATE()))) and ((convert(varchar, job_date, 108) >= '23:30:00')))
I tried this query however, I only get yesterday jobs from 23:30. The >= on selecting the date is only giving me yesterday. I see that is caused by the time portion being selected as > 23:30 which would only select the jobs on the next date that were greater than this.
Not sure how to write the correct syntax.
Would appreciate help writing a clean query to give me all records as needed.