Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I want only one record in my query.
Message
From
04/06/1999 13:58:44
 
 
To
04/06/1999 12:40:33
Martin Thibault
Minière Québec Cartier
Port-Cartier, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00226574
Message ID:
00226635
Views:
17
>In this statement : "select * from db where cnum = 'c'".
>
>I want that query return only one record and the query stop after find one record. I don't want that the query scan all the database for it.
>

SELECT * FROM db WHERE cnum = bletch GROUP BY cnum

You're going to run into some confusion if any field is not duplicated across all records where you match; it'll take the first value, and you have no assurance of exactly which record will be selected from the set of possible matches. You could add computed fields to the SQL select to tell you how many records actually did match, take sums, whatever. If you always want the first record and there's an index on cnum, you could position to it withouyt neding a SELECT:
SELECT db
LOCATE FOR cnum = "c"
IF FOUND()
  *  there's at least one, and you're at the first one
ELSE
  * no records match
ENDIF
>What I can append to this query to do it?
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform