Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在查询中,我想显示员工的月薪。如果结果低于该值,我想在查询中显示 1500 的薪水,否则我想保留在查询中得到的总和。
有谁知道该怎么做?
基本思想是使用case语句。像这样的东西:
case
select (case when salary < 1500 then 1500 else salary end) as salary
select case when salary<1500 then 1500 else salary end , column2 ,column3 from mytable