Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • What if the total_orders is not evenly divisible by 3? What version of SQL Server are you using? Commented Jan 18, 2019 at 14:03
  • The query will be run inside a SaaS application so they don't expose exactly what SQL Server they're running... I do know its variant of T-SQL (sorry I know this probably isnt much help). To keep things simple, let's say if the total_orders doesn't evenly divide by 3 we don't need them. If we could still get the previous rows (i.e. total count is 11 but we have rows for 3, 6 9) that would be great, but I feel this might over complicate it all. Commented Jan 18, 2019 at 14:20