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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:55:11+00:00 2026-05-30T18:55:11+00:00

Table Structures: tblCustomer Customer_id created field1 field2 cardno ——————————————————– 1014 Test1 Cell Phone 123146

  • 0

Table Structures:
tblCustomer

Customer_id  created   field1      field2        cardno
--------------------------------------------------------    
1014     Test1     Cell Phone  123146        1234567890
1015     Test2     Email       abc@xyz.com   2345678891

tbl_TransactionDishout

Trnx_id   offerNo   TerminalID      Created                  cardno
-------------------------------------------------------------------
1         1014      170924690436418 2010-05-25 12:51:59.547  1234567890

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

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

My current query is something like this:

select created,
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
from tblCustomer c
group by created 
order by created desc

But It’s giving me the result of the date contained only in tblCustomer table..

Now, How to get Deals_redeemed..?
relation between tbl_transaction and tblCustomer is having same cardno…

  • 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-30T18:55:13+00:00Added an answer on May 30, 2026 at 6:55 pm

    In my understanding table tbl_TransactionDishout is an offer, and if it is followed through a record will be inserted into tblCustomers; if not, nothing will change. So deals redeemed is count of non-existing records in tblCustomers for given cardno:

    select t.created,
       count(c.field1) Enrolled,
       count(case c.field1 when 'E-mail' then 1 end) Enrolled_as_Email,
       count(case c.field1 when 'Cell Phone' then 1 end) Enrolled_as_Cell,
       count(case when c.field1 is null then 1 end) [Deals Redeemed]
    from tbl_TransactionDishout t left join tblCustomer c 
       on t.cardno = c.cardno
    group by t.created
    order by t.created desc
    

    EDIT: c.created changed to t.created

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

Sidebar

Related Questions

Table Structures: tblCustomer Customer_id created field1 field2 cardno field14 ------------------------------------------------------------------------------------------------ 1014 2010-05-25 12:51:59.547 Cell
Table Structures: tblCustomer Customer_id created field1 field2 cardno field14 ------------------------------------------------------------------------------------------------ 1014 2010-05-25 12:51:59.547 Cell
Table Structures: tblCustomer Customer_id created field1 field2 cardno field14 ------------------------------------------------------------------------------------------------ 1014 2010-05-25 12:51:59.547 Cell
I found the following table structures while I was watching ruby on rails tutorial.
Say I have a database called Poll and have these two table structures. poll
I'm trying to bind a table of structures to a DataGridView. Loading and viewing
I have two tables with the following (simplified) structures: table "Factors" which holds data
I have a table TreeStructures wich holds structures of Trees. This table has columns
I have quite a few situations where I have database structures similar to: TABLE
I have a couple of tables with similar structures like this: <table> <tbody> <tr>content</tr>

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.