|
Posted by Gary L. Burnore on 10/04/07 22:39
On Thu, 04 Oct 2007 12:44:17 -0000, phpCodeHead
<phpcodehead@gmail.com> wrote:
>On Oct 3, 9:33 pm, Gary L. Burnore <gburn...@databasix.com> wrote:
>> On Wed, 3 Oct 2007 21:16:22 -0400, "Shelly"
>>
>>
>>
>> <sheldonlg.n...@asap-consult.com> wrote:
>>
>> >"axlq" <a...@spamcop.net> wrote in message
>> >news:fe1auv$g0r$1@blue.rahul.net...
>> >> In article <1191424134.543150.96...@o80g2000hse.googlegroups.com>,
>> >> Claudio Corlatti <corla...@gmail.com> wrote:
>> >>>well i didn't understand your question very well, but i suppose that
>> >>>you want to obtain just one row from the table "colors".
>>
>> >>>to do that you need to add a "where" clause in your mysql query, for
>> >>>instance "select * from colors where idColor=1"
>>
>> >> That will work, but a LIMIT should also be specified for efficiency.
>> >> The query "SELECT * FROM MyColorTable WHERE ColorID=26 LIMIT 1" will
>> >> cause MySQL to stop searching the table as soon as one row is found.
>> >> Otherwise it will keep searching for other rows with ColorID=26.
>>
>> >> -A
>>
>> >WHY does the OP wand to stop at one? Is this simply check for the
>> >existinance of some value in a particular field/ If that is so, why not use
>> >the COUNT operator in the sql call?
>>
>> Maybe because if you've got hundreds of thousands of rows to count
>> and, instead, you want to stop after looking at only one to see if the
>> table is non-empty, you'd save some processing time?
>>
>>
>>
>> >Shelly
>>
>> --
>> gburnore at DataBasix dot Com
>> ---------------------------------------------------------------------------
>> How you look depends on where you go.
>> ---------------------------------------------------------------------------
>> Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
>> | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
>> Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
>> | ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
>> Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
>> ===========================================================================
>
>The LIMIT clause is the most efficient means of returning one and only
>one row from at table of data LIMIT 1.
>
>Or, three and at most three. LIMIT 3.
>
>All other means listed here require a significant amount of additional
>and, depending upon your applications needs, quite needless processing
>to get the job done.
>
You sure quoted a lot to say "I agree" :)
--
gburnore at DataBasix dot Com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
Official .sig, Accept no substitutes. | ÝÛ³ºÝ³Þ³ºÝ³³Ýۺݳ޳ºÝ³Ý³Þ³ºÝ³ÝÝÛ³
| ÝÛ 0 1 7 2 3 / Ý³Þ 3 7 4 9 3 0 Û³
Black Helicopter Repair Services, Ltd.| Official Proof of Purchase
===========================================================================
[Back to original message]
|