|
|
 |
Re: FN-FORUM: MySQL Query Problems
date posted 31st January 2006 15:03
>The code D wants to use to work on MySQL 3, 4 or 5 is this (subject to
>typos):
>
>SELECT ABSClients.*
>FROM `ABSClients`
>LEFT JOIN `ABSdocs_clients`
>ON ABSClients.clientID = ABSdocs_clients.clientID
>WHERE ABSdocs_clients.imageID != YOUR SEARCH CONIDION HERE
>
>A join CAN be used to eliminate results. And getting the DB engine to do it
>will probably be optimal, especially if the tables are properly indexed.
>
>
>
So *That* is what left joins are for. That will pull out all the items
from the ABSClients that do not have a corresponding member of the
ABSdocs_clients will it?
I've been using SQL for many years on many different databases but I've
only needed outer, left or right joins so infrequently that I tend to
forget what exactly they in between projects that actually need them...
I completely agree about keeping data manipulation in the Database- I do
everything I can to avoid putting too much processing into the hands of
my scripting language, when I'm using one- it's like using the edge of a
spanner to hammer nails into something, you can do it but if you have a
hammer it's probably a better tool for the job.
-ben
|
 |
|