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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:04:25+00:00 2026-06-16T01:04:25+00:00

Following is my table schema. Channel listing table: CHAN_NUMBER CHAN_NAME CHAN_TYPE ———– ———————————– 1

  • 0

Following is my table schema.

Channel listing table:

    CHAN_NUMBER  CHAN_NAME   CHAN_TYPE
 ----------- -----------------------------------
      1 MTV                   Music
      2 ESPN                  Sports
      3 TNT                   Movies
      4 Fox                   Movies
      5 Fox                   Sports

customer survey table:

   SURV_ID SURV_DATE SURV_FAV_CHAN CUST_NUMBER
 ---------- --------- ------------- -----------
     1     25-NOV-12             1           2
     2     24-NOV-12             2           1
     3     24-NOV-12             3           3
     4     24-NOV-12             4           4
     5     24-NOV-12             5           5
     6     24-NOV-12             1           6
     7     24-NOV-12             2           7
     8     24-NOV-12             3           8
     9     24-NOV-12             4           9
    10     24-NOV-12             5          10
    11     24-NOV-12             1          11

I have these two tables that I need to generate a report that lists every channel and a count of how many customers have selected that channel as their favorite.

On oracle database I got up to the point where I am generating a count of each time a channel was selected as a favorite from the SURVEY table. But I can’t figure out how to join them to create a list of channels displaying the channel number, the name and the count of customers who chose it as their favorite.

-- my channel table query


SELECT CHAN_NUMBER, CHAN_NAME FROM CHANNEL;


-- here is how I'm generating the couNt


SELECT COUNT(SURV_FAV_CHAN) FROM SURVEY
GROUP BY SURV_FAV_CHAN HAVING COUNT(SURV_FAV_CHAN) > 1;

ANY HELP WOULD BE AWESOME.

  • 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-16T01:04:26+00:00Added an answer on June 16, 2026 at 1:04 am

    You can try something like this:

    SELECT MAX(CH.CHAN_NUMBER), MAX(CH.CHAN_NAME), COUNT(SRV.SURV_FAV_CHAN) FROM SURVEY SRV  
    LEFT JOIN CHANNEL CH ON CH.CHAN_NUMBER = SRV.SURV_FAV_CHAN
    GROUP BY SRV.SURV_FAV_CHAN HAVING COUNT(SRV.SURV_FAV_CHAN) > 1;
    

    And you may want to use SUM(SRV.SURV_FAV_CHAN) if you really need the total amount of customers if I understand you question correctly

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

Sidebar

Related Questions

I have the following pseudo-SQL schema: table flight id int primary key date timestamp
I have no control over database schema and have the following (simplified) table structure:
With the following DB schema: CREATE TABLE master ( id integer primary key autoincrement,
Consider a table with the following schema: id, location, starred There are many records
My nycgrid table with the following schema id,x1,x2,y1,y2 . And it looks like following
Given the following data/schema: DECLARE @t1 TABLE ( Id int NOT NULL ) DECLARE
I have a bunch of coordinates in my table grid with the following schema
I have test_scores table with following fields: Table schema: id (number) score1 (number) score2
Assuming I have the following schema table A: ID int primary key value varchar(255)
I have a table schema similar to the following (simplified): CREATE TABLE Transactions (

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.