Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL - SELECT command
Message
From
19/11/1998 04:27:27
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/11/1998 02:21:43
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00159134
Message ID:
00159150
Views:
23
>Hi all,
>
>I have two problems:
>
>1.)
>I have table. From this table I want create cursor where get to all record in this cursor number for his position in cursor.
>First record in cursor have "position" 1, second record in cursor have
>"position" 2, ....
>The "position" is new column in cursor.
>How Can I solve this problem ?
>
>2.)
>How Can I create SELECT (cursor), where load only one record with specified position by ORDER item.
>Example: I want get only 5th record from table ordered by "name" ("name" is index column in table)
>
>Thanks.
Martin,
If I read you correct you won't need that position column (recno() of new cursor ?). Anyway :
select reccount() as position,* from myTable ;
  order by myOrder ;   
  into cursor myTmpCrs nofilter
use dbf("myTmpCrs") in 0 again alias myCursor
use in "myTmpCrs"
select myCursor
replace all position with recno()
For second I think you would need a second select from "myCursor" :
select * from myCursor ;
 where position = 5 ...
You could drop usage of replace in first and the second SQL for the latter with UDF and subqueries, but I think you won't gain performance doing so.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform