added sql for calculating far diff