Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT Statement
Message
From
31/05/2001 08:03:46
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00513062
Message ID:
00513081
Views:
11
>>I have a select statement that needs to search for the nearest matches in a talbe. If the user enters "T" in the search field, then the select statment to select all those records that begin with T. Set near is ON, Set Exact is Off. But what happens is that all the records that begin with T show up but so does everything after T, names with U, V,W, X, Y,Z....can anyone assist?
>
>Try SET KEY TO 'T' RANGE 'Tz'
>
>Never tried this on SELECT, but I think it works there too.
>It scopes to a "filter" on the given range, and uses the concerning index (yep, which you must have).

you could not worry about the set exact and
select * from TableName where Lname = "T%"

Notice the single equels sign.
you could replace the Lname = "T%" with between(Lname, "T%", "Sn") for a specific range.

or a little bit of a messy solution for a range where the Starting or ending value may produce 0 hits ( cut and paste from working program ):

select *, recno() as recno from part where id like m.ending ;
union ;
select *, recno() as recno from part where id like m.Starting ;
union ;
select *, recno() as recno from part where between(id, m.Starting, m.Ending ) ;
into cursor realtemp ;
order by 1
- jer
Previous
Reply
Map
View

Click here to load this message in the networking platform