ortho count needed sql statement ordering in some cases