Re: Months later ... i have an SQL soluce for "what is the rank ofthis data in an index order?"

Author: Gérard Lochon

Posted: 2012-07-10 at 13:25:32

----- Original Message -----

>

> Is there any value to know the location # from BOF(), and if there is

> why is closer better depending on index?

BOF() is an XBase iterative function, nothing to do witrh SQL ensembly

conceipt.

Somewhere, excluding it.

However; it is always possible to replace this lack of logic.

If we consider the previous example :

[VFP]

CREATE CURSOR test ;

(lib c(10),mt i)

INSERT INTO test VALUES ("john",10)

INSERT INTO test VALUES ("jennifer",15)

INSERT INTO test VALUES ("stella",25)

INSERT INTO test VALUES ("sophia",40)

INSERT INTO test VALUES ("greg",50)

INSERT INTO test VALUES ("jeff",20)

[/VFP]

It is possible to "create a rank" according to a choosen order.

Let's do it. We choose to order "mt" values :

[VFP]

SELECT xx.lib, xx.mt, COUNT(yy.mt) as rank ;

FROM test xx, test yy ;

WHERE xx.mt <= yy.mt ;

GROUP BY xx.lib, xx.mt ;

ORDER BY xx.mt DESC, xx.lib DESC

[/VFP]

Once upon this order is made, we can determine

a numeric distance delta (your question) from

BOF() or EOF().

The final request beeing trivial,

i would't offense your professional side

by giving you tricks on me.

Gérard.

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/319F4887E914446C8F14B49241435148@MuriellePC

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Gérard Lochon