#you can use having on derived columns. SELECT a,b,c,(a*b+c) AS d, n FROM table HAVING d > n ORDER by d