updated SQL queries in kistat