Is there a simple query for the above just separated by branch? All I need is totals per branch each month.
Thanks in advance.
Is there a simple query for the above just separated by branch? All I need is totals per branch each month.
Thanks in advance.
Hello Colleen,
Would something like this work?
declare @startdate as datetime='2025-02-01'
declare @enddate as datetime='2025-03-01'
select organizations.name, count(*) as 'in house checkouts'
from transactionheaders with (nolock)
left join organizations with (nolock) on transactionheaders.organizationid=organizations.organizationid
left join transactiondetails with (nolock) on transactionheaders.transactionid = transactiondetails.transactionid
where transactiontypeid = 6002 -- 6002 = check ins
and transactionsubtypeid = 128 -- 128 = checkin type
and numvalue in (6,56) -- 6 = in house checkin, 56 = Leap in house checkin
and transactiondate between @startdate and @enddate -- transaction in given time frame
group by organizations.name
order by organizations.name
@ebrondermajor looks like a great query, but one suggested change would be swapping transactiondate and using tranclientdate instead. The reason is that tranclientdate is indexed meaning the system can seek directly to the needed dates rather than having to scan the entire table.
Thank you @wesochuck @ebrondermajor both so much. I’m going to try this out tomorrow when I’m back in the office. I’m so happy this forum is taking the place of the Sierra listserv I found so valuable.