defjam90
16th May 2008, 06:07
I would like to choose distinct records from tdinv001 by tdinv001.cwar & tdinv001.stoc

here is the querry,

Select distinct tdinv001.cwar,tdinv001.stoc
from tdinv001

In baan session i get an error but works fine with toad.

Please let me know the syntax in Baan

Andreas
16th May 2008, 08:23
look here,

http://www.baanboard.com/programmers_manual_baanerp_help_functions_database_handling_sql_syntax

Andreas

günther
16th May 2008, 09:54
Baan SQL does not support the distinct keyword. So you have two choices to implement it:
1. use "hold" variables to detect the change (initialize it before the select statement, read all rows within the range, detect changes inside the selectdo part)
2. try "group by" (less code, but it might take longer than version 1)

Günther

loveubaan
16th May 2008, 11:48
use :
Select tdinv001.cwar,tdinv001.stoc
from tdinv001
group by tdinv001.cwar,tdinv001.stoc
selectdo
endselect

rahul.kolhe22
17th May 2008, 14:20
Baan SQL does not support the distinct keyword. So you have two choices to implement it:
1. use "hold" variables to detect the change (initialize it before the select statement, read all rows within the range, detect changes inside the selectdo part)
2. try "group by" (less code, but it might take longer than version 1)

Günther

Hi,
I also had the same situation, where I was need of distinct keyword. I tried solving it by using the inner query.
Here in the quoted text you told to use "hold" variable to initialize, I was unable to find this this variable anywhere in the programmers guide. Can you please tell me here I will find the information for this variable

bdittmar
17th May 2008, 22:37
Hi,
I also had the same situation, where I was need of distinct keyword. I tried solving it by using the inner query.
Here in the quoted text you told to use "hold" variable to initialize, I was unable to find this this variable anywhere in the programmers guide. Can you please tell me here I will find the information for this variable

Hello,

what Guenther means, is :

define your own HOLD Variables (Like hold.orno, hold.pono) and save the values for current record in this variable, before you read the next recordset.

Regards