Fix backend order query only to use distinct when needed

* This fixes most of the cases for redundant distinct usage. There may
  be more. But these are most common and most pressing on the DB size we
  have.
Merge pull request #41 from MountainRoseHerbs/2-3-stable-mrh-fix-admin-order-index-performance

Fix backend order query only to use distinct when needed