当前位置:网站首页>SQL create a new field based on the comparison date

SQL create a new field based on the comparison date

2022-06-23 09:57:00 CSDN Q & A

There are two fields in the data table, as shown in the following figure

img

img

Now I want to go through sql Create a new one for each record according to the size of the two dates type Field , assignment 0 perhaps 1, Be similar to

iif( to_char(aendtime,'yyyy-mm-dd') <= to_char(dplan_complete_time),0,1) as type ,

Easy to do BI According to this type Field grouping

Would like to ask what is a good way

原网站

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206161811040079.html