INNER JOIN with an OLE sql statement

Lyda_Faye

New Member
Joined
Feb 20, 2003
Messages
49
Can I do a join in a select statement that is formatted for OLE?

I am not having much luck in trying it. The whole thing locks up on me. Here is code that runs fine under ORACLE SQL. Now I need to use it in EXCEL. Please help me to do it. The objective is to get the JOIN to work.

Thanks.

SELECT spriden_id, spriden_last_name||', '||spriden_first_name||' '||spriden_mi,
PEBHSIN_INCIDENT_DATE, PEBHSIN_DESC, PEBHSIN_INCIDENT_DATE, lpad(PEBHSIN_NO,6,0),
PERHSIP_OSHA_IND, PERHSIP_WORK_COMP_IND, perhsip_posn, a.nbrjobs_orgn_code_ts,
ftvorgn_title, ztrhsbc_activity_date,ztrhsbc_bwc_claim_no, perhsim_hsme_code, perhsim_begin_date, perhsim_end_date, perhsim_hours_lost, perhsim_hours_work_restricted, ptrhsme_desc, sysdate
FROM ftvorgn, pebempl, SPBPERS, nbbposn, nbrjobs a, SPRIDEN, perhsim, ztrhsbc, PTRHSIL, ptrhsme, PERHSIP, PEBHSIN
WHERE (ztrhsbc_hsin_no = PEBHSIN_NO) And (PTRHSIL_CODE = PEBHSIN_HSIL_CODE) And (PERHSIP_HSIN_NO = PEBHSIN_NO)
and nbbposn_posn = a.nbrjobs_posn AND (FTVORGN_orgn_code = a.nbrjobs_orgn_code_ts
and ftvorgn_coas_code = 'C' and (to_char(ftvorgn_nchg_date,'DD-MON-YYYY') = '31-DEC-2099'))
and a.nbrjobs_pidm = pebempl_pidm and a.nbrjobs_effective_date in (select max(b.nbrjobs_effective_date)
FROM nbrjobs b where a.nbrjobs_posn = b.nbrjobs_posn and a.nbrjobs_pidm = b.nbrjobs_pidm and a.nbrjobs_pidm = b.nbrjobs_pidm)
and a.nbrjobs_pidm = spriden_pidm and (spriden_change_ind is NULL)
and spriden_entity_ind = 'P' and a.nbrjobs_posn = perhsip_posn
and (TO_CHAR(ztrhsbc_activity_date,'MM/DD/YYYY')) >= &nbidate
and (TO_CHAR(ztrhsbc_activity_date,'MM/DD/YYYY')) <= &neidate
and perhsim_hsme_code = ptrhsme_code and SPBPERS_PIDM = a.nbrjobs_PIDM AND a.nbrjobs_PIDM = PERHSIP_PIDM
and perhsim_pidm = spriden_pidm(+)
and perhsip_pidm = perhsim_pidm(+)
GROUP BY spriden_id, spriden_last_name, spriden_first_name, spriden_mi,
PEBHSIN_INCIDENT_DATE, PEBHSIN_DESC, PEBHSIN_INCIDENT_DATE, lpad(PEBHSIN_NO,6,0), PERHSIP_OSHA_IND, PERHSIP_WORK_COMP_IND, perhsip_posn, a.nbrjobs_orgn_code_ts,
ftvorgn_title, ztrhsbc_activity_date, ztrhsbc_bwc_claim_no, perhsim_hsme_code, perhsim_begin_date, perhsim_end_date, perhsim_hours_lost, perhsim_hours_work_restricted, ptrhsme_desc, sysdate
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,221,573
Messages
6,160,591
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top