Link to home
Start Free TrialLog in
Avatar of ali şahin
ali şahin

asked on

I want to bring number values ​​under names.

hi expert
I wrote a query like this
select DRADI.ADI_SOYADI as namee,count(*) as count_x from protokol,dradi where PROTOKOL.DR_KODU=DRADI.DR_KODU group by DRADI.ADI_SOYADI  
the output of this query is as follows.

Şule ŞİMŞEK      5440
Check Up Polikliniği      847
Aslıhan Çakır      38
Furkan KARALOĞLU      4
Yıldız EKMEKÇİ      1267

I want to set the given names as columns.
I want to bring number values ​​under names.

the template I want is below

Şule ŞİMŞEK    Check Up Polikliniği   Aslıhan Çakır  Furkan KARALOĞLU   Yıldız EKMEKÇİ
5440                  847                                38                      4                                      1267

how can I do that.?
thanks
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

That is called a PIVOT.  Here is an 11g article on it.  It's an older version but explains it pretty well:
https://www.oracle.com/technical-resources/articles/database/sql-11g-pivot.html

The problem is that you need to know the MAXIMUM number of columns you can have before doing it.
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ali şahin

ASKER

thnks a lot :)
what could I do if the number of person was too high?
What would happen if the number of people was between 100 and 300?
I don't know where / if there is a limit on the number of names that you could have.  But if you had 100 names, how would that output be "useful", since it would be way to long to view or print in the horizontal format it would represent?  Are you trying to accomplish something else?


»bp
you are right.
ı mustn't print more than 10 data horizontally.it doesn't make much sense.
I just wondered
thank you so much :)