如何使用Datecreated列查找no.of列 [英] How to find no.of columns using Datecreated column

查看:52
本文介绍了如何使用Datecreated列查找no.of列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,





我的要求是,如果一个用户增加了5名成员,他将为他的学分增加1学分表。为此我在这个表中使用memberconnection表列是

ID,RequieredMemberID,RecipientMemberID,Datecreated,StatusID。我想找出使用​​Datecreated栏的成员(RecipiencememberID')计数。

假设从今天到明天晚上的例子,我将得到5名成员,我希望将1个学分添加到另一个表。从明天晚上起,假设在

5days后我会得到5个成员数我想再添加1个积分就像循环一样。如何计算no.of成员(ReceipientMemberID)。

如何使用memberconnection中的datecreated列执行此要求。请告诉我任何一个。





谢谢

Hello all,


My requirement is, if one user is added 5 members , he will add 1 credit to his credit table. For this i am using memberconnection table in this table columns are
ID, RequieredMemberID, RecipientMemberID, Datecreated, StatusID. I want to find out members(RecipiencememberID''s) count using Datecreated column.
Suppose example from todaydate to tommorrow evening i will get 5 members count i want to add 1 credit to another table. from tomorrow evening onwards suppose after
5days i will get 5 members count i want to add another 1 credit just like loop . How count no.of members(ReceipientMemberID).
How i will do this requirement using datecreated column in memberconnection . Please tell me any one.


Thanks

推荐答案

- 为下面的代码编写一个程序,将startdate和enddate作为参数



声明@startdate datetime;

声明@enddate datetime;



声明@count int;



从memberconnection中选择@count = count(*),其中Datecreated> = @startdate和Datecreated< = @ enddate



if @ count> = 5

begin

---添加信用

结束
--write a procedure for the below code which takes startdate and enddate as parameter

Declare @startdate datetime;
Declare @enddate datetime;

declare @count int;

select @count=count(*) from memberconnection where Datecreated >=@startdate and Datecreated<=@enddate

if @count>=5
begin
---add credit
end


这篇关于如何使用Datecreated列查找no.of列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆