remade event finding method into simple sql query