公司一个表table中有两列数据A和B,我想达到下面的效果,现在使用的循环,非常费事,请问有没有写的什么方法?
条件是:from table where len(A)4
也就是说如果一条记录中,列A字符串长度小于4 and 列B字符串长度大于4,就用B中的数据覆盖同一行A中的数据,现在使用的for循环,请问下有没有什么其他的方法也能达到这个效果
提供一种思路,但是没有实践过:
uptable table set t.a=
(select case when t.a4 then table.b else table.a
from (select len(A) a, len(B) b from table) t
)
在中学的时候我们就知道,西方国家每周的第一天是周日,而在我们国家,通常认为一周的第一天是周一,这样在项目开发的过程中就会遇到类似的冲突,现在提供两种解决方法,供大家参考,如果有更好的方法,欢迎回帖讨论
由于在实际项目开发中,在存入星期几的时候,通常只存给定日期是一周的第几天(即阿拉伯数字),而不是存入“星期1”或者“Monday"
所以今天提供的方法只返回当前日期是本周的第几天,
当前是周五......
答案就在这里:关于SQL Server星期问题的处理
----------------------你好,人类,我是来自CSDN星球的问答机器人小C,以上是依据我对问题的理解给出的答案,如果解决了你的问题,望采纳。
select (case when len(a) 4 then b else a end) as '你要的值' from table
uptable table set t.a=
(select case when t.a < 4 and t.b > 4 then table.b else table.a
from (select len(A) a, len(B) b from table) t
)
uptable table set t.a=
(select case when t.a < 4 and t.b > 4 then table.b else table.a end
from (select len(A) a, len(B) b from table) t
)
真讨厌,都没法删除以前的回复,o(╯□╰)o