parames
27th September 2002, 11:24
Hi list,
how to select only one record from Sql query...

For example, the query is like this:

select tdinv700.*
from tdinv700
where tdinv700._index1 = {:item.code," ","XXX",:idat}
order by tdinv700. trtm desc, tdinv700.sern desc

this query will give me few records.. but, i just want to select only one record (the first record)

In windows base sql we use limit one to select only one record (the first record)...
select ---
from ---
order by --- limit 1

But how to do this in Baan program script..

Thanks a lot..

Parame.s

morpheus
27th September 2002, 11:58
Use AS SET WITH n ROWS.
Here n is the number of records you want to select.

manusatsangi
27th September 2002, 12:26
Hi,
Use the set clause as follows:

select ..........
from ..........
where .......
order by .......
as set with 1 rows

This will yield only 1 record.

- Manu

parames
27th September 2002, 12:54
Thanks a lot morpheus and manusatsangi...

Regards,
Parame.s