sql server - SQL Query Logic -
i have 2 table
1)activitymaster
activityid ,activitydesc,registereddate
2)approvalconfig
approvalid,userid,activityid,approvaldate
both table have activityid in common .
once activity registered in activitymaster re-occurs after 30 days
1)activity should visible user after 30 days , after approval should not appear until next approval date comes (i.e 30 days)
i using below query logic not working expected.
select case when dateadd(dd,datediff(month, registereddate,getdate()) *30,registereddate) < (select isnull(max(approvaldate),0) approvalconfig c c.activityid= activityid) 0 -- hide approval link else 1 -- show approval link end linkshow activitymaster
e.g user register activity on 5 jan 2017 , visible next user approval after every 30 days .
1)activity visible next user on 6 feb 2017 , 6 march 2017 respectively
2)once activity approved not shown in dashboard.i.e if user approved on 7 feb 2017 activity not visible until next approval date comes i.e 6 march 2017
Comments
Post a Comment