ailisee
18th July 2011, 12:40
I want to count the number of distinct sales order in table whinh431 for a specific shipment number.

i use sql statement as below, but i get error "...Error SQL: SQLState 42I00: Unexpected token 'distinct' (error 302)" when compiling the report script in LN,

select count(distinct a.worn)
from whinh431 a
where a.shpm =:shipment

I cannot count the "disctinct" field? If so, what can I do?

VishalMistry
23rd July 2011, 08:47
Hi,
Other way you can try is using one variable and increament it in select do

select distinct a.worn
from whinh431 a
where a.shpm = :shipment
selectdo
cnt=cnt+1
endselect

Vishal

ailisee
25th July 2011, 04:57
Thanks for you guidance,
i found another method:

select count(*):rcount.so
from (select distinct a.worn
from whinh431 a
where a.shpm =:shipment) get_distinct_so


Hi,
Other way you can try is using one variable and increament it in select do

select distinct a.worn
from whinh431 a
where a.shpm = :shipment
selectdo
cnt=cnt+1
endselect

Vishal