get ip-address by sql query