上传者: 46827076
|
上传时间: 2022-04-06 01:54:13
|
文件大小: 9KB
|
文件类型: PNG
在sqlserver数据库表中有字段A B C三个字段的数据,要求用sql写出如果A大于B则输出A否则输出B,如果·B大于C则输出B否则输出C.
select (case when a>b then a else b end),
(case when b>c then b else c end)
from table_name
用B数据库的字段替换A数据库的字段
update table
set content = b.content
from 数据库B.table b
where b.ID = table.ID