update LZ_COUNT_SOURCES_yue set CNS_DIAL_NUMBER = cishu
set CNS_LAST_CALL = zhthsj
select max(a.CAL_CALL_DATE_TIME) as zhthsj,COUNT(*) as cishu from LZ_CALL_LOG a
where CAL_CONNECT_TIME_LEN > 0 and CAL_CALL_DIRECT = 2
怎么合并成为一个sql语句
数据库如何实现先update 然后select
答案:3 悬赏:30 手机版
解决时间 2021-03-19 21:00
- 提问者网友:城市野鹿
- 2021-03-19 00:27
最佳答案
- 五星知识达人网友:不甚了了
- 2021-03-19 01:46
如果是sqlserver:
update LZ_COUNT_SOURCES_yue set CNS_DIAL_NUMBER = aaa.cishu set CNS_LAST_CALL = aaa.zhthsjfrom
(select max(a.CAL_CALL_DATE_TIME) as zhthsj,COUNT(*) as cishu from LZ_CALL_LOG a) aaa
where CAL_CONNECT_TIME_LEN > 0 and CAL_CALL_DIRECT = 2
update LZ_COUNT_SOURCES_yue set CNS_DIAL_NUMBER = aaa.cishu set CNS_LAST_CALL = aaa.zhthsjfrom
(select max(a.CAL_CALL_DATE_TIME) as zhthsj,COUNT(*) as cishu from LZ_CALL_LOG a) aaa
where CAL_CONNECT_TIME_LEN > 0 and CAL_CALL_DIRECT = 2
全部回答
- 1楼网友:患得患失的劫
- 2021-03-19 03:12
可以写个事务!事务的具体语法可百度!
- 2楼网友:妄饮晩冬酒
- 2021-03-19 03:00
感觉触发器可以的,更新完执行查询
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯