同一数据库中有A,B两张表,表A中有A1字段 和表B中B1字段相同
答案:2 悬赏:0 手机版
解决时间 2021-02-05 09:09
- 提问者网友:骨子里的高雅
- 2021-02-05 03:51
同一数据库中有A,B两张表,表A中有A1字段 和表B中B1字段相同,表B中还有字段C,表A中还有字段D,怎样跟据字段C把 表A中的字段D和B1列出来?高手求教
最佳答案
- 五星知识达人网友:詩光轨車
- 2021-02-05 04:35
select a.d,b.b1 from A a left join B b on a.A1=b.B1 where a.C = ?(默认提供左连接写法,根据你的需求自己选择适合的连接)
全部回答
- 1楼网友:杯酒困英雄
- 2021-02-05 05:11
if (object_id('tgr_update', 'tr') is not null)
drop trigger tgr_update
go
create trigger tgr_clasupdate' b
for update
as
declare @a1 int, @newb1 int;
--更新前的数据
select @oldnewb1=b1,@a1=a1 from inserted
if (@olnewb1==1)
begin
--更新后的数据
update a set a2= 1 where a1 = @a1
end
go
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯