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 6386473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:01:52+00:00 2026-05-25T03:01:52+00:00

I was wondering what method is most used when creating a query that displays

  • 0

I was wondering what method is most used when creating a query that displays sales for two different months (selected in the parameter).

My database looks something like this:

Posting Date    Company      Size    Sales
01/01/2011      Microsoft    1000    900

I already have a parameter where “year month” is selected.
What I want is to have two parameters so that I can compare the sales in “year month” side by side in Microsoft Visual Studio.

So the query should have two parameters, @PostingDate1 and @PostingDate2

Thanks for any help!

–UPDATE–

Trying to make this more understandable.

The two parameters to select from will be “year month”

So that the result table will look like this when “year month” is selected for parameter 1: january 2011, and parameter 2: february 2011 (doesn´t matter what months are selected, just that the results will show the different months)

Company     Size     Sales1    Sales2
Microsoft   1000     100       200

That is if sales for january 2011 was 100

and sales for february 2011 was 200

  • 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-05-25T03:01:52+00:00Added an answer on May 25, 2026 at 3:01 am

    I think that you want to do a CROSS JOIN, but I’m not completely sure that I understood your question. If the results of your query are onle ONE row, then I recommend a CROSS JOIN, of not, then its probably better not to use it. It should be something like this:

    SELECT A.[Posting Date] [Posting Date 1], A.Company Company1, A.Size Size1, A.Sales Sales1,
           B.[Posting Date] [Posting Date 2], B.Company Company2, B.Size Size2, B.Sales Sales2
    FROM (SELECT [Posting Date], Company, Size, Sales
          FROM YourTable
          WHERE [Posting Date] = @PostingDate1) A
    CROSS JOIN (SELECT [Posting Date], Company, Size, Sales
                FROM YourTable
                WHERE [Posting Date] = @PostingDate2) B
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just wondering which method is the most effective if I'm literally just wanting
I'm wondering what the best method is for creating a forgot password function on
I am wondering if anyone has used the userInteractionEnabled method on a UILabel to
One simple method I've used in the past is basically just creating a second
I have an application that connects to a database and can be used in
I was wondering what would be the most simple but secure method for the
Just wondering if this is the most efficient method of doing this? is there
I'm wondering what is the most elegant way to handle exceptions that depend on
I was wondering how TransactionScope class works to keep the transaction between different method
I was wondering if anybody knew of a method to configure apache to fall

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.