View previous topic :: View next topic
|
Author |
Message |
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
Is there any way that this query can be optimised??
SELECT B.SOC_SEC_NUM || ';' ||
B.LAST_NAME || ';' ||
B.FIRST_NAME || ';' ||
IFNULL(CHAR (B.BRTH_BIRTH_D), ' ') || ';' ||
B.GROUP_NUMBER || ';' ||
C.GROUP_NAME
FROM EMP_TABLE B
JOIN
GRP_TABLE C
ON B.GROUP_NUMBER = C.GROUP_NUMBER
WHERE B.PART_KEY IN
(
SELECT DISTINCT A.PART_KEY
FROM PAY_TABLE A
WHERE A.PAY_D > CURRENT DATE - 6 MONTHS
)
AND
B.PAY_STATUS IN
('00', '01', '07') |
|
Back to top |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
Probably. Have you run an explain on it? |
|
Back to top |
|
|
raak
Active User
Joined: 23 May 2006 Posts: 166 Location: chennai
|
|
|
|
ya.. it was saying that DISTINCT should be avoided and Nonqualified function ( I think it is the IFNULL condition) should also be avoided.
but I am creating a report out of this and DISTINCT cannot be avoided since there is gud possibility of duplicates occuring in that field.
Any thoughts on this??? |
|
Back to top |
|
|
|