select least(greatest(col2-substr(col1,1,6),0),3) from ...
bobfang(匆匆过客)很感谢你对这个贴子的回答,但这个贴子里后一个问题,有好的解决方案吗?select least(greatest(col2-substr(col1,1,6),0),3) As rlt1 least(greatest(col2-substr(col1,1,6),0),3)/3 As rlt2 from ...类似上面的SQL文,因为least(greatest(col2-substr(col1,1,6),0),3) 重复计算了,效率会低一些,能不能有什么方法只计算一次?
least(greatest(col2-substr(col1,1,6),0),3) As rlt1
least(greatest(col2-substr(col1,1,6),0),3)/3 As rlt2
from ...类似上面的SQL文,因为least(greatest(col2-substr(col1,1,6),0),3) 重复计算了,效率会低一些,能不能有什么方法只计算一次?