View previous topic :: View next topic
|
Author |
Message |
raveepisini
New User
Joined: 23 Nov 2010 Posts: 1 Location: chennai
|
|
|
|
Hi
Please find below statement
SELECT A.ACCOUNT, A.SECURITYID
FROM TABLE1 A, TABLE2 B
WHERE A.TABLE1_ACCOUNT SUBSTR(1,3) = B.TABLE2_IBD
WITH UR;
In the table1 it contains almost 54millons records
Int the table 2 it contains only 1000 records..
Because of above select statement my job running almost 10mins as elapse time and 4min cpu time.. I know in the like statment we can concatenate 2table_field to get value. Please provide me how to do..
Table1_account field size is 15
Table2_ibd file size is 3
I want to write it as
SELECT A.ACCOUNT, A.SECURITYID
FROM TABLE1 A, TABLE2 B
WHERE A.TABLE1_ACCOUNT LIKE (B.TABLE2_IBD)
WITH UR;
Please let me know how to do that
[/code] |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Code: |
WHERE A.TABLE1_ACCOUNT SUBSTR(1,3) = B.TABLE2_IBD |
until you can be accurate and honest with us,
(the above sql in not proper syntax)
we are wasting our time even looking at this. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Suggest you post the execution of the query you posted.
As DBZ posted, the syntax is not proper. . . |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
You can't use like, but you might want to try something like this :
Code: |
WHERE A.TABLE1_ACCOUNT between B.TABLE2_IBD || x'00' and B.TABLE2_IBD || x'FF' |
|
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Using the same strange syntax, I would try:
Code: |
WHERE A.TABLE1_ACCOUNT SUBSTR(1,3) IN (SELECT DISTINCT TABLE2_IBD FROM TABLE2) |
|
|
Back to top |
|
|
|