Danny,
Wednesday, March 13, 2002, 2:30:10 PM, you wrote:

DK> I'd like to know how I can do the following:

DK> I want to query a single table like this:

DK> select field1, field2, field3 from table1 where field1='something' and 
DK> field2=0;

DK> This query will result in more then one match. It's not possible for me to 
DK> use a more specific query.
DK>  From the result I only need the first hit. All the other rows are not 
DK> important. (e.g. I get 100 rows back, but I only need 1)

DK> So my question:

DK> How can I stop the query on the first match and return the result of that 
DK> match and prevent the query from fetching all matching records (and limit 
DK> the results afterwards by using LIMIT 1). This is mainly for boosting the 
DK> performance of mys queries.

DK> Actually where using mysql to dynamically assign ip addresses to our 
DK> dial-in users. We query the database for available addresses -> there are 
DK> more than 1 available but I only need 1!

Why don't you use only LIMIT 1 clause to get just one row?

DK> Thanks in advance!
DK> Danny Kruitbosch





-- 
For technical support contracts, goto https://order.mysql.com/
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to