Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7827543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:55:42+00:00 2026-06-02T09:55:42+00:00

I have 2 queries, with Parameters. I can get them to report individualy, however

  • 0

I have 2 queries, with Parameters. I can get them to report individualy, however I want both tables on 1 report. The problem is, a subreport seems to be problematic using parameters… My 2 queries are:

SELECT        A.Store_Number, A.GC_Sold, B.Total_Cars

FROM            (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) AS A INNER JOIN

(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) AS B ON A.Store_Number = B.Store_Number

This output gives me data for a date range and looks like this:

Store    gc sold      total cars
1        5             8
2        6             9
3        7             10

My Second query is:

SELECT        A.Store_Number, A.GC_Sold, B.Total_Cars

FROM            (SELECT        Store_Number, COUNT_BIG(Quantity_Sold) AS GC_Sold

FROM            Invoice_Detail_Tb

WHERE        (Invoice_Date = CONVERT(DATETIME, @enddate, 102)) AND (JLI_Category_Code = 'gc') AND (Invoice_Detail_Code LIKE 'jlgc%') AND (Invoice_Detail_Type = 'Item')

GROUP BY Store_Number) AS A INNER JOIN

(SELECT        Store_Number, SUM(Vehicle_Count) AS Total_Cars

FROM            Daily_Sales_Tb

WHERE        (Operations_Day = CONVERT(DATETIME, @enddate, 102))

GROUP BY Store_Number) AS B ON A.Store_Number = B.Store_Number

This output returns data just for enddate. and looks identical to the table above.

The user is picking the startdate and enddate on a windows form and pushing “go”. The parameters are then passed to report viewer… Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:55:44+00:00Added an answer on June 2, 2026 at 9:55 am

    If this is a SQL Server Reporting Services report, then you can add multiple data sets. In your case, the first would use the first query, the second data set would use the second query with both data sets using the same shared data source (=> database connection).

    Then you can add two tables to the report – one referencing the first data set as its data source, the other referencing the second data set.

    The same can be modeled for local reports.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have some queries which group datasets and count them, e.g. SELECT COUNT(*) FROM
I have 2 queries that get involved in a deadlock situaution displayed in the
I'm trying to get parameters from the menu table in Joomla. What I have
i have an asp.net-mvc site and one of the pages is http://www.mysite.com/Report users can
I have a method which takes an array of strings as parameter and queries
I'am using GWT 2.4 with Hibernate and RequestFactory and I have queries like this
I have two queries, as following: SELECT SQL_CALC_FOUND_ROWS Id, Name FROM my_table WHERE Name
I have 2 queries. First: SELECT * FROM `table` WHERE col='xyz' LIMIT 100 //Time
I have two queries. The first one is.. INSERT INTO balik ( balik_date, balik_time,
I have two queries use [DatabaseAA] select * ,DATEDIFF(MINUTE,SomeDate,'3/28/2012 12:52:25 PM +00:00') This passes,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.