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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:01:37+00:00 2026-05-30T10:01:37+00:00

My first query where I got problem here : Tricky GROUP BY issue on

  • 0

My first query where I got problem here : Tricky GROUP BY issue on ORACLE is now definitely resolved.

However I have a new question. I try to transform it, one more time to have now this output :

                        |           EMAIL          |              WIFI          | ...         
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Yes             |             20           |                24          | ...                 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
         No             |              4           |                 0          | ...        
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Unknown             |              1           |                 1          | ...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Here the data to help you to build such output. I tried to use again unpivot / pivot with the query that René gave me in the resolved issue I quote, but unfortunately I got the error that
“ORA-56901: non-constant expression is not allowed for pivot|unpivot values” sighh…

with 
count_table as (
     select 1001 device_id,  4 quantity from dual union all
     select 1002 device_id, 20 quantity from dual union all
     select 1003 device_id,  1 quantity from dual 
),
device_table as (
     select 1001 id, 'Yes'     wifi, 'No'       email, 'No'  bluetooth from dual union all
     select 1002 id, 'Yes'     wifi, 'Yes'      email, 'No'  bluetooth from dual union all
     select 1003 id, 'Unknown' wifi, 'Unknown'  email, 'Yes' bluetooth from dual 
)

Maybe there is a simpler solution for this ? I definitely need to read a book about relational DB:)

  • 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-30T10:01:38+00:00Added an answer on May 30, 2026 at 10:01 am

    it is looking very simple after referring your previous post..
    please try the below query for that …

    with 
    count_table as (
         select 1001 device_id,  4 quantity from dual union all
         select 1002 device_id, 20 quantity from dual union all
         select 1003 device_id,  1 quantity from dual 
    ),
    device_table as (
         select 1001 id, 'Yes'     wifi, 'No'       email, 'No'  bluetooth from dual union all
         select 1002 id, 'Yes'     wifi, 'Yes'      email, 'No'  bluetooth from dual union all
         select 1003 id, 'Unknown' wifi, 'Unknown'  email, 'Yes' bluetooth from dual 
    )
    ----------------------------------------
    select * from (
          select
            feature,
            yes_no_unknown,
            sum(quantity)  quantity
          from 
             count_table  c join 
             device_table d on c.device_id = d.id
          unpivot  ( yes_no_unknown
                     for feature in (wifi, email, bluetooth)
          ) 
          group by 
          feature,
          yes_no_unknown
    )  
    pivot ( sum (quantity)
            -- only this line I have changed  ..
            for feature in ('WIFI' as Wifi, 'EMAIL' as Email, 'BLUETOOTH' as Bluetooth)
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a performance problem on a query. First table is a Customer table
here's my problem: I have an SQL query that makes 4 calls to a
Ok, I've got an interesting problem here. I have two tables, tips and votes.
I have a following oracle query: SELECT a.USER_ID, c.first_name, c.last_name, TO_CHAR( b.logon_date, 'MM/DD/YYYY HH:MI:SS
I have a query that I want to execute that fastest possible. Here it
I've got a problem with this query....or, not yet as much as I will
I've got three tables I would like to query for a single dataset. Here
I've got this complex situation. Created EF with Model first and here are my
First of all: I wish you all Merry Christmas :) I've got some problem
I'm running a query that is timing out for first two times and returning

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.