herambphalke
24th April 2008, 11:58
Hi Guys,
SOS !! Urgent
I have been trying to retrieve the last records from a table with various means and methods , although using some codes was able to get the correct results but it takes too much time. :mad:
I need something like Oredr by tdpur041.odat desc limit 1 / "select top 1* from titim001315" / TOP N :cool: results in 4 GL for a report
code am trying to use is somewhat like
function read.main.table()
{
select tihyv701.*, tiitm001.*
from tihyv701, tiitm001
where tihyv701.item between :item.f and :item.t
and tiitm001.kitm = 1
and tihyv701.sitm refers to tiitm001
selectdo
date = tiitm001.ltpp
currency = tiitm001.ccur
price = tiitm001.prip
select tdpur041.*, tdpur040.*
from tdpur041, tdpur040
where tdpur041.item = :tihyv701.sitm
and tdpur041.odat > :date
and tdpur041.orno refers to tdpur040
order by tdpur041.odat desc
selectempty
rprt_send()
selectdo
date = tdpur041.odat
currency = tdpur040.ccur
price = tdpur041.pric
rprt_send()
endselect
|rprt_send()
endselect
}
===========================
or may be
{
select tihyv701.* from tihyv701
where tihyv701.item between :item.f and :item.t
|as set with 1 rows
selectdo
select tiitm001.item from tiitm001
where tiitm001.item = :tihyv701.sitm
and tiitm001.kitm = 1
|as set with 1 rows
selectdo
select tdpur041.* from tdpur041
where tdpur041.item = :tiitm001.item
order by tdpur041.odat desc
|as set with 1 rows
selectdo
rprt_send()
endselect
endselect
endselect
}
==================================
or even this will do
select tihyv701.*, tiitm001.item, tiitm001.dsca, tdpur041.orno, tdpur041.pono, tdpur041.odat, tdpur041.cupp, tdpur041.pric, tdpur041.suno, tdpur040.ccur
from tihyv701, tiitm001, tdpur041, tdpur040
where tihyv701.item between :item.f and :item.t
and tihyv701.sitm refers to tiitm001
and tiitm001.kitm = 1
|and tdpur041.odat between :date.f and :date.t
and tdpur041.item refers to tiitm001
and tdpur041 refers to tdpur040
order by tdpur041.odat desc
selectdo
rprt_send()
endselect
===========================
Would request you all to help ASAP as this has taken me too long tthan ai expected and noe its super urgent
Thanks:)
SOS !! Urgent
I have been trying to retrieve the last records from a table with various means and methods , although using some codes was able to get the correct results but it takes too much time. :mad:
I need something like Oredr by tdpur041.odat desc limit 1 / "select top 1* from titim001315" / TOP N :cool: results in 4 GL for a report
code am trying to use is somewhat like
function read.main.table()
{
select tihyv701.*, tiitm001.*
from tihyv701, tiitm001
where tihyv701.item between :item.f and :item.t
and tiitm001.kitm = 1
and tihyv701.sitm refers to tiitm001
selectdo
date = tiitm001.ltpp
currency = tiitm001.ccur
price = tiitm001.prip
select tdpur041.*, tdpur040.*
from tdpur041, tdpur040
where tdpur041.item = :tihyv701.sitm
and tdpur041.odat > :date
and tdpur041.orno refers to tdpur040
order by tdpur041.odat desc
selectempty
rprt_send()
selectdo
date = tdpur041.odat
currency = tdpur040.ccur
price = tdpur041.pric
rprt_send()
endselect
|rprt_send()
endselect
}
===========================
or may be
{
select tihyv701.* from tihyv701
where tihyv701.item between :item.f and :item.t
|as set with 1 rows
selectdo
select tiitm001.item from tiitm001
where tiitm001.item = :tihyv701.sitm
and tiitm001.kitm = 1
|as set with 1 rows
selectdo
select tdpur041.* from tdpur041
where tdpur041.item = :tiitm001.item
order by tdpur041.odat desc
|as set with 1 rows
selectdo
rprt_send()
endselect
endselect
endselect
}
==================================
or even this will do
select tihyv701.*, tiitm001.item, tiitm001.dsca, tdpur041.orno, tdpur041.pono, tdpur041.odat, tdpur041.cupp, tdpur041.pric, tdpur041.suno, tdpur040.ccur
from tihyv701, tiitm001, tdpur041, tdpur040
where tihyv701.item between :item.f and :item.t
and tihyv701.sitm refers to tiitm001
and tiitm001.kitm = 1
|and tdpur041.odat between :date.f and :date.t
and tdpur041.item refers to tiitm001
and tdpur041 refers to tdpur040
order by tdpur041.odat desc
selectdo
rprt_send()
endselect
===========================
Would request you all to help ASAP as this has taken me too long tthan ai expected and noe its super urgent
Thanks:)