got sql working for member query