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?

Member Avatar for diafol
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)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.