Re: need help to build a query
| From: | Larry Garfield | Date: | Tue, 10 Oct 2006 00:11:56 +0000 |
| Subject: | Re: need help to build a query | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242878@lists.php.net to get a copy of this message | ||
On Monday 09 October 2006 16:50, John Wells wrote:
> Yes you are right, but I guess you can decide which is worse: sending
> extra data in one query or send extra queries. I guess it depends on
> how many records we're talking about...
It will vary with your problem, but in general, fewer queries == A Good Thing.
If you can do with a join or subselect what would take n queries otherwise,
do so.
Also, JOIN is faster than sub-queries. Be aware, though, that MySQL doesn't
support sub-queries until version 4.1.
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson