query select all and do something