Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Topics

Recent Status Updates

View All Updates

- - - - -



  • Please log in to reply
No replies to this topic

#1 shmoo22


    CC Newcomer

  • Member
  • PipPip
  • 11 posts

Posted 22 April 2012 - 01:56 PM


I have 2 queries that I would like to report on report viewer in 1 table... Is this possible? Or do I need to modify the query's to be a single query and then report that? I've been working on combining the 2 queries forever, and it's just not working so I'm thinking if I can report the 2 queries to 1 table on a single report viewer that would work as well.



My Queries are listed below. Separately the queries work as designed, however I'd like the data to be something like this: I was wondering if I created 2 data sets is there an way to pull the field value of Total cars from the one query and drop it into the same table? I've been trying to combine the queries with derived tables, but will they report in report viewer? Trying to get the query correct with derived tables has proved problematic.

Store Number GC Sold Total Cars
12 7 25
13 12 45
14 15 65

SELECT Store_Number, COUNT_BIG(Quantity_Sold) AS GC Sold
FROM Invoice_Detail_Tb
WHERE (Invoice_Date BETWEEN CONVERT(DATETIME, @startdate, 102) AND CONVERT(DATETIME, @enddate, 102)) AND (JLI_Category_Code = 'gc')
AND (Invoice_Detail_Code LIKE 'jlgc%') AND (Invoice_Detail_Type = 'Item')
GROUP BY Store_Number

SELECT Store_Number,
SUM(Vehicle_Count) AS [Total_Cars]
FROM Daily_Sales_Tb
WHERE (Operations_Day BETWEEN CONVERT (DATETIME, @startdate, 102) AND CONVERT (DATETIME, @enddate, 102))
GROUP BY Store_Number;


  • 0

Also tagged with one or more of these keywords: Reporting

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download