Skip to content Skip to sidebar Skip to footer

Sql Having Between A Date Range

I am trying to retrieve the count of records between a certain date range that is specific to the users min date and max date in another table. This is what I have so far, however

Solution 1:

Try:

HAVING rtam.dbo.wfm_process_instance.LOCAL_USER_START_TIME 
  >=CONVERT(DATE, MIN(rtam.dbo.gnr_tbl_72_type.LOCAL_COL_113)) 
AND rtam.dbo.wfm_process_instance.LOCAL_USER_START_TIME 
  < DATEADD(DAY, 1, CONVERT(DATE, MAX(rtam.dbo.gnr_tbl_72_type.LOCAL_COL_113))

You might also think about using aliases so that you don't have to repeat lengthy and error-prone references like rtam.dbo.wfm_process_instance all over your code.

Post a Comment for "Sql Having Between A Date Range"