我有一个现有的存储过程,它有很多硬编码的IF条件。该过程检查下列输入字段的值并显示相关消息:字段为:现有消息表:1 AAAA 2 BBBB 3 CCCC 4 MMMMIF(BrandId in (5,10)) SELECT ‘BBBB’ as MsgTextEND IF
SELECT ‘AAAA’ as MsgT
-----------------2 Bridgekeeper 0SELECT m.MESSAGEID, m.SENDER, FROM MESSAGE m LEFT JOIN MESSAGEPART mpON mp.MESSAGEID = m.MESSAGEID GROUP BY m.MESSAGEID) AS
我正在尝试停止插入到MessageId表中的重复TestMobileRecipient。目前,在存储过程多次运行时,除了“将移动详细信息插入电子邮件收件人表”部分外,sql查询的所有部分都可以正常工作,此时TestMobileRecipient表中有重复的messageid。detail into the Email Recipient table
MessageId, Mobi
我得到了一个包含消息的表(简化):FromUserId,TextLastMessageId,Text所以我想出了这个: ,(Text) ,(ToUserId)
FROM [Messages] ainner join (select FromUserId as FromId, ToUserId as ToId, Max(MessageId<