If you are a potential client of mine, or rather a current one, please stop reading NOW, as it’s one of these embarrassing “I am sometimes too stupid” posts.
That’s how my 3am code can look like:
It’s for NHibernate style paging (i.e. firstResult is for a 0 based index)
Spotted (thanks to DbAwareIntegrationTests) and fixed at 6pm