Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

count multiple columns with group by in one query

jaijeevaFeb 21 2017 — edited Feb 21 2017

Hi,

Kindly help me out to handle these requirements in single query that i have to be show unique user which will get either created_by or approved_by or

ticketed_by then who all are created that total records count which will be checked by created_by,

who all are approved that total records count which will be checked by approved_by,

who all are ticketed that total records count which will be checked by created_by.

create table LF_OTHER_GDS_BOOKING1

(

ID NUMBER(15),

PNR_NO VARCHAR2(50),

SURNAME VARCHAR2(100),

SUPPLIER VARCHAR2(2),

STATUS VARCHAR2(2),

CREATED_DATE DATE,

CREATED_BY VARCHAR2(50),

APPROVED_DATE DATE,

APPROVED_BY VARCHAR2(50),

TICKETED_DATE DATE,

TICKETED_BY VARCHAR2(50)

)

/

INSERT INTO lf_other_gds_booking1

(id, pnr_no, surname, supplier, status, created_date, created_by,

approved_date, approved_by, ticketed_date, ticketed_by)

VALUES

(101, 'YLA4UK', 'kannan', '1', '3',

to_date('20-05-2016 13:01:15', 'dd-mm-yyyy hh24:mi:ss'), 'Jai',

to_date('20-05-2016 15:28:51', 'dd-mm-yyyy hh24:mi:ss'), 'Kishore',

to_date('20-05-2016 17:20:22', 'dd-mm-yyyy hh24:mi:ss'), 'John');

INSERT INTO lf_other_gds_booking1

(id, pnr_no, surname, supplier, status, created_date, created_by,

approved_date, approved_by, ticketed_date, ticketed_by)

VALUES

(105, 'YKDFQ9', 'kannan', '1', '3',

to_date('20-05-2016 14:40:13', 'dd-mm-yyyy hh24:mi:ss'), 'Kishore',

to_date('20-05-2016 16:17:37', 'dd-mm-yyyy hh24:mi:ss'), 'John',

to_date('20-05-2016 19:30:34', 'dd-mm-yyyy hh24:mi:ss'), 'Jhon');

INSERT INTO lf_other_gds_booking1

(id, pnr_no, surname, supplier, status, created_date, created_by,

approved_date, approved_by, ticketed_date, ticketed_by)

VALUES

(111, 'YI3IGO', 'asdsad', '8', '3',

to_date('20-05-2016 18:41:41', 'dd-mm-yyyy hh24:mi:ss'), 'Jai',

to_date('20-05-2016 19:29:56', 'dd-mm-yyyy hh24:mi:ss'), 'Jhon',

to_date('23-05-2016 11:04:13', 'dd-mm-yyyy hh24:mi:ss'), 'Kishore');

INSERT INTO lf_other_gds_booking1

(id, pnr_no, surname, supplier, status, created_date, created_by,

approved_date, approved_by, ticketed_date, ticketed_by)

VALUES

(112, 'YIWIUA', 'ssdf', '4', '3',

to_date('20-05-2016 19:21:36', 'dd-mm-yyyy hh24:mi:ss'), 'Kishore',

to_date('23-05-2016 09:27:15', 'dd-mm-yyyy hh24:mi:ss'), 'Jai',

to_date('23-05-2016 12:10:01', 'dd-mm-yyyy hh24:mi:ss'), 'sadmin');

INSERT INTO lf_other_gds_booking1

(id, pnr_no, surname, supplier, status, created_date, created_by,

approved_date, approved_by, ticketed_date, ticketed_by)

VALUES

(114, 'YIPFT9', 'asd', '4', '3',

to_date('23-05-2016 12:46:47', 'dd-mm-yyyy hh24:mi:ss'), 'Jai',

to_date('23-05-2016 13:35:39', 'dd-mm-yyyy hh24:mi:ss'), 'Kishore',

to_date('23-05-2016 17:27:32', 'dd-mm-yyyy hh24:mi:ss'), 'Jai');

commit;

                                                           Created User                Approved User          Ticketed User

pastedImage_1.png

This post has been answered by Solomon Yakobson on Feb 21 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 21 2017
Added on Feb 21 2017
5 comments
1,288 views