When I do this:
select chargegroupid from txn where accountid = 9949796 group by chargegroupid having max(txn.created) > DATEADD(DAY, -45, GETDATE())
I get over 200 rows. And that's tame. I've got some situations where I've got over 800.
On the other hand, when I do this:
select created, chargegroupid from txn where accountid = 9949796 and created > DATEADD(DAY, -45, GETDATE())
I get 70 rows, which is the recordset that I need.
How do I change the original query so I'm getting my 70 rows as opposed to the 200?