SQL help, I have redundant rows and my grouping is not right

Have a great weekend and thanks so much

1 Like

Maybe post the finished query so it could benefit someone else.

2 Likes
Select top 40 myCode, sum(myQTY) as Quantity, count(myCode) as Count
from testmytable
where (t_stamp > DATEADD(minute, -50, GETDATE())))
Group by myCode
order by sum(myQTY) DESC;

It was like this at the finish

which was really confusing because I thought this had thrown an error on me before

It worked though