Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> can you mix a substr function with a where exists?
I have a table T1 that has a column with an account number concatenated with other information this account number ranges from 5-10 digits. 45676541234 = acct: 4567654 plus 1234
I have another table T2 that has the account numbers by then selves with other columns. acct 4567654
i want find all the accounts in T2 that exist in T1 and bring out information the follwoing sql will do
select I_ACCT_NBR, C_ACCT_NBR, BILLING_SYSTEM, WHERE_BILLING from
T2
where exists (select studyid from T1 where T1.studyid
= C_acct_nbr)
however, it will not work because all the accounts in T1 have that extra amount of info in them
I thought to do the following
select I_ACCT_NBR, C_ACCT_NBR, BILLING_SYSTEM, WHERE_BILLING from
T2
where exists (select studyid from T1 where substr(T1.studyid, 1, 5)
= substr(T2.C_ACCT_NBR, 1,5))
but i get no rows returned
any help Received on Thu Jun 17 1999 - 16:19:04 CDT