|
Posted by Shelly on 10/04/07 01:16
"axlq" <axlq@spamcop.net> wrote in message
news:fe1auv$g0r$1@blue.rahul.net...
> In article <1191424134.543150.96700@o80g2000hse.googlegroups.com>,
> Claudio Corlatti <corlatti@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?
Shelly
Navigation:
[Reply to this message]
|