Commonly Used Queries
Commonly Used Queries
SELECT * FROM siebel.s_srv_req sr WHERE SR_STAT_ID = 'Open'; 2. Select a Particular Service Request with a Service Request Number
SELECT * FROM siebel.s_srv_req sr WHERE SR_NUM='1-7791439'; 3. Select a Service Request Number, Status, and Account with Service Reques t Numbers SELECT sr.SR_NUM, sr.CREATED, sr.SR_STAT_ID As Status, org.NAME AS Account FROM siebel.s_srv_req sr LEFT OUTER JOIN siebel.S_ORG_EXT org ON sr.CST_OU_ID = org.ROW_ID WHERE sr.sr_num IN ('1-26996996', '1-26996360') 4. Select Employee Positions
select c.fst_name, c.last_name, cp.party_id, p.name from siebel.s_contact c, siebel.s_party_per cp, siebel.s_postn p where c.row_id = cp.person_id and cp.party_id = p.row_id and order by c.last_name, c.fst_name; 5. Find all Employees with the Position of Sales
select c.fst_name, c.last_name, u.login, p.name POSITION from siebel.s_contact c, siebel.s_party_per cp, siebel.s_postn p, siebel.s_us er u where c.row_id = cp.person_id and cp.party_id = p.row_id and c.row_id = u.row_id and p.name = 'SALES' order by c.last_name, c.fst_name 6. Select all Employee Responsibilities
select c.fst_name, c.last_name, r.name from siebel.s_contact c, siebel.s_per_resp er, siebel.s_resp r where c.row_id = er.per_id and er.resp_id = r.row_id order by c.last_name, c.fst_name 7. Find detailed information for a Responsibility with Responsibility Name
SELECT * FROM siebel.s_resp r WHERE r.NAME = 'Customer Service Representative' 8. Find and Employee list with a primary Responsibility Id
select * from siebel.s_contact WHERE PR_RESP_ID='0-31' 9. Select all Employee s Logins, Positions, Divisions, and Organizations.
select c.fst_name, c.last_name, u.login, p.name POSITION, d.name DIVISION, o.na me ORGANIZATION from siebel.s_contact c, siebel.s_party_per cp, siebel.s_postn p, siebel.s_or g_ext d, siebel.s_bu o, siebel.s_user u
where
c.row_id = cp.person_id and cp.party_id = p.row_id and p.ou_id = d.row_id and p.bu_id = o.row_id and c.row_id = u.row_id order by c.last_name, c.fst_name 10. Select a service request with an Account Name (Company Name)
SELECT sr.SR_NUM, sr.CREATED, sr.SR_STAT_ID As Status, org.NAME AS Account FROM siebel.s_srv_req sr LEFT OUTER JOIN siebel.S_ORG_EXT org ON sr.CST_OU_ID = org.ROW_ID
SELECT sr.SR_NUM, sr.CREATED, sr.SR_STAT_ID As Status, org.NAME AS Company FROM siebel.s_srv_req sr INNER JOIN siebel.S_ORG_EXT org ON sr.CST_OU_ID = org.ROW_ID 11. Select a Service Request with a Service Request Number, Account, Created Date, Created By, and Owner select sr.SR_NUM, Org.NAME Account, sr.CREATED, u.login CREATED_BY, u2.login OW NER from siebel.s_srv_req sr inner join siebel.s_contact c on c.row_id = sr.cst_con_id left outer join siebel.s_user u on sr.created_by = u.row_id left outer join siebel.s_user u2 on sr.owner_emp_id = u2.row_id left outer join siebel.s_Org_ext Org on sr.cst_ou_id = Org.ROW_ID 12. Find Users who have access to a View
SELECT ROW_ID FROM siebel.S_APP_VIEW WHERE NAME='Personal Service Request List V iew - Admin' SELECT RESP_ID FROM siebel.S_APP_VIEW_RESP WHERE VIEW_ID='1-11SQ5'; select c.ROW_ID, c.fst_name, c.last_name, r.name, er.ROW_ID, r.ROW_ID from siebel.s_contact c, siebel.s_per_resp er, siebel.s_resp r where c.row_id = er.per_id and er.resp_id = r.row_id and r.row_id = '1-11SQY' order by c.last_name, c.fst_name