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

  • Home
  • SEARCH
  • 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 7577251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:08:13+00:00 2026-05-30T17:08:13+00:00

Is it possible to get the result as below from the same table date-wise

  • 0

Is it possible to get the result as below from the same table date-wise records:

               Enrolled   Enrolled as Email  Enrolled as Text Deals Redeemed   
<First Date>   7          5                  2                6
<Next Date>    9          3                  6               14

Table structure look something like this:

Customer_id, field1, field2, responsecode, created_date

My current query is something like this:

select created_date,
   count(field1) Enrolled,
   count(case field1 when 'E-mail' then 1 end) Enrolled_as_Email,
   count(case field1 when 'Cell Phone' then 1 end) Enrolled_as_Cell,
   count(responsecode) Deals_Redeemed
   from tblCustomer
   group by created_date
   order by created_date

Which works fine for the first three columns but for the four column that is “Deals redeemed” which is a sub query from another table.

Select COUNT(*) from tbl_TransactionDishout where DishoutResponseCode = '0000'

Table Structure is as below:
Table name is “tbl_TransactionDishout”

    [Trnx_ID] [int] IDENTITY(1,1) NOT NULL,    
    [OfferNo] [nvarchar](50) NULL,   
    [MerchantID] [nvarchar](50) NULL,    
    [TerminalID] [nvarchar](50) NULL,    
    [DishoutResponseCode] [nvarchar](50) NULL,    
    [Created] [datetime] NULL    
  • 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-30T17:08:14+00:00Added an answer on May 30, 2026 at 5:08 pm

    Can you try like this. (The Deals_Redeemed value will be same for all rows, you said there is no relation between two tables)

    select created_date,
        count(field1) Enrolled,
        count(case field1 when 'E-mail' then 1 end) Enrolled_as_Email,
        count(case field1 when 'Cell Phone' then 1 end) Enrolled_as_Cell,
        (Select COUNT(*) from tbl_TransactionDishout where DishoutResponseCode = '0000') as Deals_Redeemed
    from tblCustomer
        group by created_date
        order by created_date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to get the result as below from the same table date-wise
Possible Duplicate: Get all files from VSS for a given date? I need to
I want to get a max value from below code. Is it possible using
Is it possible to get records between a Timespan from a DataTable using the
Is it possible to get the text of an OleDbCommand with all parameters replaced
Is it possible to get the originating port from an ActionExecutingContext object? If so,
Possible Duplicate: Mysql single query join 3 table and get all the results Hi
Possible Duplicate: Get xpath location of element in iframe(iframe from my domain) I have
Possible Duplicate: Get CVS history for a particular user Is it possible to list
Is it possible to get gdb or use some other tools to create a

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.