ken bohnenkamp
4th January 2003, 22:36
I have a table (aracp010) that is indexed by fields docn and stnl. I am trying to count the number of stnl for a given docn using SQL and then would like to display this count on a form. I can't seem to get it to work. Here is an example of what the records in the table aracp010 might look like:
DOCN STNL
0001 AEX111
0001 AEX111
0001 AEX111
0001 AEX222
0001 AEX222
In this example, the count of stnl should be 2 for docn 0001. Below is an example of the SQL I am using. Can anyone gime me some idea what I am doing wrong.
Any help would be greatly appreciated.
function count.of.detail()
{
select aracp010.docn, aracp010.stnl,
count (aracp010.stnl):count.detail
from aracp010
group by aracp010.docn, aracp010.stnl
having aracp010._index1 = :aracp009.docn
selectdo
selectempty
count.detail = 0
endselect
}
DOCN STNL
0001 AEX111
0001 AEX111
0001 AEX111
0001 AEX222
0001 AEX222
In this example, the count of stnl should be 2 for docn 0001. Below is an example of the SQL I am using. Can anyone gime me some idea what I am doing wrong.
Any help would be greatly appreciated.
function count.of.detail()
{
select aracp010.docn, aracp010.stnl,
count (aracp010.stnl):count.detail
from aracp010
group by aracp010.docn, aracp010.stnl
having aracp010._index1 = :aracp009.docn
selectdo
selectempty
count.detail = 0
endselect
}