count transactions with SQL if it's possible