select distinct gwc.wr_parent from g5_write_counselor as gwc left join g5_member as m on gwc.mb_id = m.mb_id where ca_name = '사주' and (wr_num between -257 and (-257 + 10000)) order by IF(state IN ('IDLE', 'CONN', 'ABSE'), 0, 1), FIELD (m.state, 'IDLE', 'CONN', 'ABSE','') limit 0, 15