Hi,
I need display something like this
Here is table User_test
USER_ID ---- NAME
1 ------------- ADAM
2 ------------- BABY
3 ------------- CATTY
4 ------------- DOGGY
5 ------------- ELLE
6 ------------- FLURRY
i want the record display like this
GroupA ----- GroupB -------GroupC
ADAM -------CATTY --------ELLE
BABY --------DOGGY --------FLURRY
but i try to write query like this
SELECT
(SELECT B.NAME FROM USER_TEST B WHERE B.NAME=A.NAME AND B.NAME IN ('ADAM','BABY') ) AS Group_A,
(SELECT C.NAME FROM USER_TEST C WHERE C.NAME=A.NAME AND C.NAME IN ('CATTY','DOGGY') ) AS Group_B,
(SELECT C.NAME FROM USER_TEST C WHERE C.NAME=A.NAME AND C.NAME IN ('ELLE','FLURRY') ) AS Group_C
FROM USER_TEST A
but it display like this
GroupA ------- GroupB -------GroupC
ADAM -------------------------------
BABY --------------------------------
---------------CATTY --------------
---------------DOGGY ---------------
--------------------------------ELLE
--------------------------------FLURRY
Any advise ?
I need display something like this
Here is table User_test
USER_ID ---- NAME
1 ------------- ADAM
2 ------------- BABY
3 ------------- CATTY
4 ------------- DOGGY
5 ------------- ELLE
6 ------------- FLURRY
i want the record display like this
GroupA ----- GroupB -------GroupC
ADAM -------CATTY --------ELLE
BABY --------DOGGY --------FLURRY
but i try to write query like this
SELECT
(SELECT B.NAME FROM USER_TEST B WHERE B.NAME=A.NAME AND B.NAME IN ('ADAM','BABY') ) AS Group_A,
(SELECT C.NAME FROM USER_TEST C WHERE C.NAME=A.NAME AND C.NAME IN ('CATTY','DOGGY') ) AS Group_B,
(SELECT C.NAME FROM USER_TEST C WHERE C.NAME=A.NAME AND C.NAME IN ('ELLE','FLURRY') ) AS Group_C
FROM USER_TEST A
but it display like this
GroupA ------- GroupB -------GroupC
ADAM -------------------------------
BABY --------------------------------
---------------CATTY --------------
---------------DOGGY ---------------
--------------------------------ELLE
--------------------------------FLURRY
Any advise ?