Multiple sql accounting queries