hi,

in my table there are two fields like “RouteId” and “Esculated RouteId”.

if RouteId is A and Esculated RouteId is B if B is existed in “RouteId” then find out the EsculatedRouteId

if the Esculated RouteId is C for RouteId B then again we have to find out the C is existing in RouteId

RouteId EsculatedRouteId

A B

B C

C D

how to write code for it

Regards

jhansi

try this,

select firstonly tablebuffer

from table

order by tablebuffer desc

where tablebuffer .recid < table1.recid;

u will get the prevous record.

thanks for ur reply

the two fields are in the same table we need to find out the last record.

in my table there are two fields like “RouteId” and “Esculated RouteId”.

if RouteId is A and Esculated RouteId is B if B is existed in “RouteId” then find out the EsculatedRouteId

if the Esculated RouteId is C for RouteId B then again we have to find out the C is existing in RouteId

RouteId EsculatedRouteId

A B

B C

C D

we have to find and returns the last record i.e RouteId is C

here we have to write looping condition every time it will work through the loop.

Regards

jhansi

str temp,temp1;

;

temp=table.firstfield;

while select tablename

{

if(temp==table.firstfield)

{

temp = table.secoundfield;

temp1=table.firstfield;

}

}

info(“temp1”);

we have aggrigate functions right one of them is minof…

//to find the last record in a table

while select tablename where minof(table.recid)

{

info(“table.firstfield”);

}

static void project(Args _args)

{

TableName tb,ntb;

str temp;

int i;

;

i=1;

while select tb

{

temp=tb.EsculatedRouteId;

while select ntb

{

if(ntb.routeid==temp)

{

i++;

break;

}

}

if(i==1)

{

info(nt.routeid);

}

else

{

i=1;

}

}

}