![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Oracle: fixing an outer join on subquery... | Elric of Grans | High Level Programming | 0 | 03-16-2009 12:43 AM |
| Alternative to date +%s | Data469 | HP-UX | 6 | 03-31-2008 03:28 PM |
| Using awk (or an alternative) | michaeltravisuk | Shell Programming and Scripting | 5 | 03-08-2007 11:37 PM |
| .NET Alternative | goon12 | UNIX for Dummies Questions & Answers | 3 | 04-06-2005 12:07 PM |
| cut -f (or awk alternative) | gefa | Shell Programming and Scripting | 6 | 03-02-2005 01:26 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi -- I have the following SQL query in my UNIX shell script -- but the subquery in the second section is very slow. I know there must be a way to do this with a union or something which would be better. Can anyone offer an alternative to this query? Thanks.
Code:
select
count(*)
from
employee_tbl
where
employee_status_cd = 'C'
or
(
employee_type_cd NOT IN ('TMGR', 'DIR')
or
(
employee_type_cd = 'MGMT'
and pay_grade_cd NOT BETWEEN '11' and '29'
)
)
or
(
employee_type_cd = 'C'
and comp_pay_pct = 0
and employee_id in (select PT.employee_id
from
payroll_tbl PT
where
PT.specl_comp_cd = '21')
)
;
Last edited by jim mcnamara; 10-05-2009 at 11:25 AM.. Reason: USE CODE TAGS please! |
|
||||
|
Did you run tkprof? ( alter session set sql_trace true
then run tkprof on the dump?if the subselect returns thousands of hits from the db, or PT.specl_comp_cd is not indexed and the table contains millions of rows then you have a problem. Is employee id indexed in the payroll_tbl? |
![]() |
| Bookmarks |
| Tags |
| select, sql, sub-query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|