You are using Delphi!?
Why don't you use event in the component to set value for Position filed.
I don't know what db control you use.
Main Topics
Browse All TopicsI'm sorting a table by points (sports sim) and I would like to figure out how I can get the row/result number saved to a field called Position?
So, basically the first result would have its Position set to '1', the second result would have its position set to '2' etc..
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
I may arrive late after the battle has ended, but this is a solution I use sometimes, when performance is not essential.
Please note that this is a rank fonction, that is to say that if several lines have the same number of points, they will have the same position... To avoid this, you may add more conditions in the where clause of the subquery.
Hi, there are two ways to do this. One is to use rdb$get_context/rdb$set_co
select rdb$get_context('USER_TRAN
the second way is to make a selectable stored procedure and use a select like this
select Klubb, GP, W, L, D, PTS, GF, GA from SP_Lag('NHL')
In that SP you will have an outpout variable named position and you will put the value to it by using something like position = :position + 1;
create or alter procedure SP_Lag (
i_name varchar(100),
returns (
position integer, Klubb, GP, W, L, D, PTS, GF, GA)
as
begin
position = 1;
for
select Klubb, GP, W, L, D, PTS, GF, GA
from Lag
where division = :i_name
order by PTS DESC, W DESC, GF DESC, Klubb ASC
into :Klubb, :GP, :W, :L, :D, :PTS, :GF, :GA
do
begin
position = :position + 1;
suspend;
end
end
Business Accounts
Answer for Membership
by: NickUpsonPosted on 2009-05-22 at 00:33:58ID: 24448470
the nearest you can do on the firebird SQL side is to have a call to gen_id in the select so that they are numbered in order (but not starting at one except the very first time)