发送短信为出生日祝福和婚礼当天 [英] Sending sms For Birth day wish and Wedding day
问题描述
查询如下;
query as follows;
Sql = "select s.Name,s.DOB,s.Mobileno,s.Weddingday from BirthDayWish s where s.Active <> 'D'";
Sql = Sql + " and year(DOB) <> '1900'";
Sql = Sql + "and month(DOB) = month(' " + Convert.ToDateTime(CurDate) + "') and day(DOB) = day (' " + Convert.ToDateTime(CurDate) + "') ";
Sql = Sql + " or year(Weddingday) <>'1900'";
Sql = Sql + " or month(Weddingday) = month('" + Convert.ToDateTime(CurDate) + "') or day(Weddingday) = day ('" + Convert.ToDateTime(CurDate) + "')";
数据库类型如下;
Database type as follows;
DOB Datetime
Weddingdate Datetime
i我发送短信给生日和婚礼。
i有以下条件
当数据库DOB中的年份和结婚日期不等于(<>)到1900年的消息时不发送。
当数据库DOB 4/2/1900年份没有发送消息时
当数据库中没有发送7/2/1900的消息时,不会发送消息。
当年数据库DOB 28/12/1985和结婚日期6/7/201在这种情况下0生日愿望和婚礼日期消息都要一次发送。
i发送查询,表单查询如何使用else写我的条件。否则发送我的上述查询的查询。
i am sending sms for Birthday And Wedding.
i have following condition
when year in database DOB and Wedding date not equal(<>) to 1900 year message not be send.
when year in database DOB 4/2/1900 message not be send
When year in database Wedding 7/2/1900 message not be send.
when year in database DOB 28/12/1985 and Wedding date 6/7/2010 in that case birthday wish and Wedding date message both to be send at a time.
i send the query,form that query how to write my condition using else.using else send query for my above query.
推荐答案
您好
Plz检查,
Hi
Plz check it,
SELECT 'Birthday' as Event , dob from dbo.BirthDayWish
WHERE YEAR (DOB) <> 1900
AND DAY(GETDATE()) = DAY (DOB)
AND MONTH(GETDATE()) = MONTH (DOB)
UNION
SELECT 'Wedding' as Event , Weddingday from dbo.BirthDayWish
WHERE YEAR (Weddingday) <> 1900
AND DAY(GETDATE()) = DAY (Weddingday)
AND MONTH(GETDATE()) = MONTH (Weddingday)
如果我错过任何条件,请告诉我。 ...
新年快乐....祝你好运:)
问候
维杰
If I missed any condition plz let me know ....
Happy New Year....wish you good luck :)
Regards
Vijay
select s.Name,s.DOB,s.Mobileno,s.Weddingday from BirthDayWish s where
Year(s.Dob)<>1900 And Convert(varchar,s.DOB,106)<>'28 Dec 1985' and Convert(varchar,s.Weddingdate,106)<>'06 Jul 2010'
享受:)
Enjoy :)
这篇关于发送短信为出生日祝福和婚礼当天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!