Re: LEFT joins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Han wrote:
Hmm,
still no luck. Thanks for the help. I think I'll have to break the

you mean that it still times out? crashes mysql? maybe the table (tc_countries) is corrupt? try doing a repair.

select up into 2 selects and throw the results of the first into arrays.

Didn't want to do it like that, but it's gonna be quicker now.

if at first you don't succeed... hack ;-)

<snip>

try removing the ORDER BY Clause:

SELECT b.fldName,
       b.fldEmail,
       b.fldCountryCode,
       d.fldCode as FCode,
       b.fldMobile,
       a.fldTime as Time,
       c.fldUsername
FROM tblSubscribersChoices a
LEFT JOIN tblUser c ON c.fldClientID = a.fldChoice
LEFT JOIN tblSubscribers b ON b.fldID = a.fldClientID
LEFT JOIN tc_countries d ON d.fldCode = b.fldCountryCode
ORDER BY c.fldUsername ASC


OR....

SELECT b.fldName,
        b.fldEmail,
        b.fldCountryCode,
        d.fldCode as FCode,
        b.fldMobile,
        a.fldTime as Time,
        c.fldUsername as Username
FROM tblSubscribersChoices a
LEFT JOIN tblUser c ON c.fldClientID = a.fldChoice
LEFT JOIN tblSubscribers b ON b.fldID = a.fldClientID
LEFT JOIN tc_countries d ON d.fldCode = b.fldCountryCode
ORDER BY Username ASC


and if that works but doesn't give you repeat records try adding the DISTINCT keyword after SELECT.

<snip>


-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux