Discussion:
Fastest Way to Find this Record ?
(too old to reply)
July Dereck
2010-06-09 07:31:51 UTC
Permalink
Hi Guys,

I have a table which is tagged on the DATE field. Each date has
multiple records. For example "31/03/2010" will have multiple records.

I wish the record pointer points at the last record of "31/03/2010".
If I do a SEEK it will point to the first record it finds of
"31/03/2010"

What I did was SEEK - "01/04/2010" (with a NEAR ON), then SKIP -1

Is there a easier way to do this with some built in Function ?

Thanks in advance.
Gianni Turri
2010-06-09 08:25:08 UTC
Permalink
Post by July Dereck
Hi Guys,
I have a table which is tagged on the DATE field. Each date has
multiple records. For example "31/03/2010" will have multiple records.
I wish the record pointer points at the last record of "31/03/2010".
If I do a SEEK it will point to the first record it finds of
"31/03/2010"
What I did was SEEK - "01/04/2010" (with a NEAR ON), then SKIP -1
Is there a easier way to do this with some built in Function ?
set order to tag "DATE" descending

then seek your date.

Gianni
Dan Freeman
2010-06-09 15:24:53 UTC
Permalink
Post by July Dereck
Hi Guys,
I have a table which is tagged on the DATE field. Each date has
multiple records. For example "31/03/2010" will have multiple records.
I wish the record pointer points at the last record of "31/03/2010".
If I do a SEEK it will point to the first record it finds of
"31/03/2010"
What I did was SEEK - "01/04/2010" (with a NEAR ON), then SKIP -1
Is there a easier way to do this with some built in Function ?
Thanks in advance.
How do you define "the last record" of a specific value? Physical
location in the table is unreliable when working with indexes. There is
no guarantee that indexes will follow physical order.

(Simple single field indexes usually do, but it's still not a
guarantee.)

Dan

Loading...