views:

38

answers:

1

I am trying to write a query that will capture calls completed within 24 hours and calls completed > 24 hours, by call rep, based off of user selected from date and to date range in a web form. I have a column for completion_date in the "yyyy-mm-dd 00:00:00" format, reps, type of call, call requested, and call assigned.

I really need some help!

+1  A: 

If you're trying to figure out the query, something like this should work:

SELECT reps, completion_date
FROM dbo
WHERE completion_date < DATEADD(DAY, DATEDIFF(DAY, 0, @DateSelectedByUser), -1)

This should get you the results within 24 hours, now for the results over 24 hours, you just use > rather than <

Brett
Thanks I'll try that!
Nacole
@Nacole - if it works for you, would you mind marking me as the answer?
Brett
Wow, nice usage of "the defaults", +1 from me!
Valentino Vranken