Note -sortIds:... returns sorted ID list not SQL to carry this out