Add sort on basic query

@robyoung
@gtrogers