in reply to (OT) perl, memory and mysql

In the spirit of give a man a fish...
SELECT AM.AM_A, AM.AM_M FROM AM LEFT JOIN AR ON AR.AR_A=AM.AM_A LEFT JOIN SA ON SA.SA_A=AM.AM_A LEFT JOIN MR ON MR.MR_M=AM.AM_M LEFT JOIN SM ON SM.SM_M=AM.AM_M #LEFT JOIN SR ON SR.SR_M=AM.AM_M WHERE AR.AR_A IS NULL AND SA.SA_A IS NULL AND MR.MR_M IS NULL AND SM.SM_M IS NULL #AND SR.SR_M IS NULL
Something close to this may be closer to the result you want. I didn't see you use a WHERE clause vs the SR table, so I left it commented out.

Replies are listed 'Best First'.
Re^2: (OT) perl, memory and mysql
by Anonymous Monk on Feb 12, 2006 at 14:20 UTC
    Hi,

    thanks for the response. Will using left joins and 'NULL' values give me the same response that my original query did (in the event of unlimited memory!) ?

    I don't really understand the use of NULL in this instance because I have no NULL values in my database and was originally checking for where two values weren't equal.

    Thanks again!

Re^2: (OT) perl, memory and mysql
by Anonymous Monk on Feb 12, 2006 at 15:04 UTC
    Hi again, I am still trying to get to grips with left joins. How would it work for the following query?

    select * from AM, AR, SA, SM, MR, SR where AR.AR_A=AM.AM_A and AR.AR_A +=SA.SA_A and SR.SR_R=MR.MR_R and SR.SR_R=AR.AR_R and AM.AM_M=MR.MR_M +and AM.AM_M=SM.SM_M and SM.SM_S=SA.SA_S and SM.SM_M=SR.SR_S;
    Kind regards!