sql 更新个人资料医生,以便按年度考试 - 92014,92004的日程安排/日程表医生进行匹配

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 更新个人资料医生,以便按年度考试 - 92014,92004的日程安排/日程表医生进行匹配相关的知识,希望对你有一定的参考价值。

CREATE TRIGGER TEPO_UPDATE_PROVIDER -- runs every time there's an insert or update to the calendar table
ON CALENDAR
FOR INSERT--, UPDATE breaks the world if update added
NOT FOR REPLICATION AS
SET NOCOUNT ON
SET ARITHABORT ON
IF EXISTS (select * from inserted i) -- makes sure we altered the calendar table before proceeding
BEGIN
UPDATE contacts
set contacts.physicianid =
	(select CASE inserted.physicianid
		WHEN '181' THEN '9' -- First is calendar doc, second is profile doc, from physician and provider tables
		WHEN '15' THEN '8' -- another doctor
		WHEN '16' THEN '7' -- another doctor
		WHEN '655' THEN '14' -- another doctor
		ELSE contacts.physicianid -- leaves the doctor alone if it not one listed above
		END
	from inserted, contacts
	WHERE inserted.subjectid in (249,250) -- from otherinventory table
		and contacts.contactid = inserted.patientid) -- makes sure it's just the patient we want
END
GO

以上是关于sql 更新个人资料医生,以便按年度考试 - 92014,92004的日程安排/日程表医生进行匹配的主要内容,如果未能解决你的问题,请参考以下文章

年度个人工作总结

安徽部分重要地区医生职称论文发表详细要求

mysql按年度季度月度周日统计查询的sql语句

个人所得税年度应纳税额抵扣-Apsara Clouder云计算专项技能认证:云服务器ECS入门[考试题及答案,已验证]

sql 按类型获取年度评估

mysql 按年度季度月度周日SQL统计查询