0

Im trying to pull two different account numbers from an ms query on an Oracle DB via ODBC with PHP. The problem is that two of the columns have the same name, e.g. ACCOUNT_NO

SELECT V_GUARANTORS2.ACCOUNT_NO, V_GUARANTORS2.GUARANTOR_NAME, V_GUARANTORS2.LOAN_NO, CURRENT_LOANS.ACCOUNT_NO, CURRENT_LOANS.LOAN_PRINC, MEMBERS.SHARES
FROM LOOK.CURRENT_LOANS CURRENT_LOANS, LOOK.MEMBERS MEMBERS, CU.V_GUARANTORS2 V_GUARANTORS2
WHERE CURRENT_LOANS.ACCOUNT_NO = MEMBERS.ACCOUNT_NO AND V_GUARANTORS2.LOAN_NO = CURRENT_LOANS.LOAN_NO AND ((V_GUARANTORS2.ACCOUNT_NO Is Not Null) AND (CURRENT_LOANS.LOAN_PRINC>0) AND (MEMBERS.SHARES<CURRENT_LOANS.LOAN_PRINC))

I've tried using an alias on the query but ms query won't accept alias'. I've tried using the full name of the columns i.e. 'V_GUARANTORS2.ACCOUNT_NO' but I get a php error saying the field name is not found.

Our support crowd might be able to change the column names to something more unique but I'd like to find a better solution in case this comes up again. Anyone have any ideas?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
0
FROM LOOK.CURRENT_LOANS CURRENT_LOANS, LOOK.MEMBERS MEMBERS, CU.V_GUARANTORS2 V_GUARANTORS2

Not hot with Oracle SQL, but these tables, CURRENT_LOANS, MEMBERS, V_GUARANTORS2 - are they from different DBs (LOOK and CU)?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.