CREATE CURSOR temp(status I) RAND(1) FOR lni = 1 TO 1000 INSERT INTO temp VALUES( INT( RAND( ) * 3 + 1 ) ) NEXT SELECT SUM( IIF( status = 1, 1, 0 ) ) as st1 ,; SUM( IIF( status = 2, 1, 0 ) ) as st2 ,; SUM( IIF( status = 3, 1, 0 ) ) as st3 ; FROM temp ; INTO CURSOR cfini>i have table with field status with values 1,2,3. i would like to count the # of records having the status 1, 2 and 3 and then put this in a cursor.
>select count(*) from mytable where status=1 into cursor csr1 > >select count(*) from mytable where status=2 into cursor csr2 > >select count(*) from mytable where status=3 into cursor csr3 > >select a.*, b.*, c.* from csr1 a, csr2 b, csr3 c into cursor csr4 >>