assassinator
16th June 2011, 09:06
I want to consult, about statistical data reproduction method
Now one table had defined Items and so many versions. The versions would have the possibility to be redundant. I need to discover redundant record.

Exp:

Item Version.
-----------------------------
Item_1 01
Item_1 02
Item_1 02
Item_1 03

select item, count(ver):ver.num
from table1
group by item
The ver.num returns value is 4, I want to obtain 3, has any realization method?

mark_h
16th June 2011, 20:19
Make your group by item and ver.

assassinator
17th June 2011, 03:50
Make your group by item and ver.

Thanks for your reply. I had tried like your advice. But the result for count(ver), group by item, ver as the same as group by item.

select item, ver, count(ver):ver.num
from table1
group by item, ver

The ver.num is 4, not 3.

mark_h
17th June 2011, 15:56
I see you edited your original post after my post, but no problem I see what you are trying to get at. To count the number of unique version per items you have to do it yourself.

uic = 0
select item, ver, count(ver):ver.num
from table1
group by item, ver
selectdo
uic= uic + 1
endselect

In this case the query will return this:
item ver count
item1 1 1
item1 2 2
item1 3 1
Then the uic variable will equal 3.