sql - Summing By Count -


I am trying to create a summation based on the calculation number for a particular column. If you look at the last line in the selection given below, you will see that I have tried to implement the case statement, however, it produces all the zero values believe I understand why (a unique set of values ​​in each row), but to me exactly how'm not sure that my problem

  SELECT TotalFilesProduced.ReviewDate, TotalFilesProduced. FileReviewedByUserID, TotalFilesProduced.FileSource, TotalFilesProduced.FilesIndexed Total Index, TotalFilesProduced.FileNumberFages total fleet Snkyaprishtprisht, TotalFilesProduced.FilesProduced, Ririveteduuaiaidiaidi case when COUNT (separate file) & gt; 1 Thomas SUM (TotalFilesProduced.FilesIndexed) END of (Cast (ibfp.FileReviewedDate as DATE) review date, Aibifpi. Smicshabuyuesaiaraidi file, file processing, COUNT (*) Failenutpadit, COUNT (aside Aibifkinboundfailaidi) Failenanukrmit, Syuem (case when IBF. = Ibfp.ToPage THEN 1 ELSE ibfp.ToPage-ibfp.FromPage + 1 END) [FileNumberofPages] dbo.InboundFilePartitions ibfp Join INNER dbo.InboundFiles ibf ibfp.InboundFileID ibf.InboundFileID CAST (ibfp.FileReviewedDate as DATE) and gt; = '10 / 22/2014 'and cast (as the date ibfp.FileReviewedDate) & lt; = '10 / 22/2014' and ibf.ProjectID (110) TotalFilesProduced.ReviewDate, TotalFilesProduced.FileReviewedByUserID, TotalFilesProduced.FileSource, TotalFilesProduced.FilesSource, TotalFilesProduced.FileNumberofPages, TotalFilesProduced.FilesProduced   by Total Artists, Grouped Artists (as ibfp.FileReviewedDate Date), ibfp.FileReviewedByUserID, FileSource) / pre> 

here's an example for further clarification - here UserID 1036 give a output after zero it appear only once but is fine for the 804 - I do yoga Want Total Indexed columns so that NULL area is 13 9 should be read (for both instances that 804 appears)

  review. UASIDID ID in file review | File Resource | Total Indexed | Total file name packaging | Files produced | (No column name) / * My yoga * / -------------------------------------- - ------------------------------------------------- - ------------------------------------------- 2014-10-22 | 804 | 1 | 1 | 67 | 1 | Zero ------------------------------------------------- -------------------------------------------------- --------------------------------- 2014-10-22 | 1036 | 1 | 1 | 17 | 1 | Zero ------------------------------------------------- -------------------------------------------------- --------------------------------- 2014-10-22 | 804 | 2 | 138 | 3322 | 184 | The comment says - it will always be false  

>

  In case when COUNT (different file reviewed UIDIDID) & gt; 1  

because

  group ibfp.FileReviewedByUserID  

and some other weird stuff

  cast (ibfp.FileReviewedDate date) & gt; = '10 / 22/2014 'and Cast (ibfp.FileReviewedDate Date) & lt;   

  as cast (as ibfp.FileReviewedDate date)  

More weird stuff

  SUM (case if P. from page = ibfp.ToPage THEN 1 ELSE ibfp.ToPage-ibfp.FromPage + 1 END) [FileNumberofPages] is  

as

  SUM (ibfp.ToPage-ibfp.FromPage + 1) [FileNumberofPages]  < / Pre> 

Not sure what you are trying to do but is not common on a group by a group


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -