Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9760

Re: Count by given date range

$
0
0

if you're doing a report that is grouped by user ID, use the method that Sastry suggested...by far the best if you're grouping by user ID...you won't need to do a subreport in that case or a command or sql expression etc.

 

however, if you're grouping by something that is not user ID, see the methods i mentioned before.

 

e.g. if your report is grouped by Month, then you can put in a cross-tab at the month level and that cross-tab has the user id as the row, and the count of user id as the summary. this gives you the user id counts by month.

 

or if you're using a command object (this is not necessary unless you're getting into a more complex report) then you can write something like the following where your prompts / parameters for the date range are in the command itself.

 

     SELECT

     `Orders`.`Order ID`,

     `Orders`.`Employee ID`,

           (

               SELECT COUNT(`Orders2`.`Employee ID`)

               FROM Orders Orders2

               WHERE Orders2.`Employee ID` = Orders.`Employee ID`

          ) AS COUNT

      FROM   `Orders` `Orders`   
     WHERE  `Orders`.`Order Date`  >=  {?DateStart}
     AND `Orders`.`Order Date`  <= {?DateEnd}


Viewing all articles
Browse latest Browse all 9760

Trending Articles



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