Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Create a loop for the Calendar Form data

$
0
0

I have created a query using view which give me results for the Tags as '1' if the work is done as per the dates on that particular day or '0' if it didn't. I have created this for October only but I want it for the whole year & also for the next year.

I know I will have to use the loop or the query will be long enough & will not work efficiently & that will turn the worse conditions.

So I just want to ask you that is there anyone which can reduce the query of mine & give me the desired output as required.

The code is as below :

SQL
UseCNSDataselect[tagno],max(casewhen(datepart(day,DueDate))='1'and(datepart(month,DueDate))='10'and(datepart(year,DueDate))='2018'then1when(datepart(day,JobDoneDate))='1'and(datepart(month,JobDoneDate))='10'and(datepart(year,JobDoneDate))='2018'then1else0end)[2018-10-01],max(case...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>