Skip to Main Content

SQL & PL/SQL

Ambiguity in the usage of select statement in "PIVOT" clause - PART II

Vysakh Suresh - 3035408Dec 22 2015 — edited Dec 22 2015

Dear All,

Kindly advise a solution for receiving the following output using the PIVOT clause.


Created with reference to :

NB : Kindly take to consideration that the tables shown here are sample data tables. Real life table contains nearly 100 menus under the MENU table and thousands of users, each having access to various menus, under USERS table.


MENU

 

MENU_ID

MENU_NAME

A

1

B

2

C

3

D

4

E

5

F

6

G

7

H

8

I

9

J

10

K

11

L

12

M

13

N

14

O

15

P

16

Q

17

R

18

S

19

T

20

U

21

V

22

W

23

X

24

Y

25

Z

26


USER1

 

USER_ID

USER_NAME

MENU_ID

U1

USER 1

A

U1

USER 1

F

U2

USER 2

A

U2

USER 2

F

U3

USER 3

B

U3

USER 3

G

U4

USER 4

B

U4

USER 4

G

U5

USER 5

C

U5

USER 5

H

U6

USER 6

C

U7

USER 7

D

U8

USER 8

D

U9

USER 9

E

U10

USER 10

E


OUTPUT

 

This post has been answered by BluShadow on Dec 22 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 19 2016
Added on Dec 22 2015
11 comments
2,317 views