Add query using alternative to ROW_NUMBER for MySQL (Bug #681210)

Change-Id: I4656a83257ce721f536347d9ccbdefdcb6f712f6
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>