November 02, 2006, 02:20 PM
MadamZuZuMutliple Counts in a BY
hi
here is my little problem.
DEFINE FILE CAR
CNTR/I1=1;
END
TABLE FILE CAR
SUM CNTR
MODEL
BY COUNTRY
BY CAR
BY BODYTYPE
ON COUNTRY SUBFOOT
"<ST.CNTR IN <COUNTRY"
END
on country i want to do a subfoot saying
this is how many different cars and bodytypes there are in this country.
the code i have now, only gives me the count for the bodytype...how do i get the total counts for the car?
hope i didn't confuse anyone
please help
November 02, 2006, 02:27 PM
LeahTry this:
DEFINE FILE CAR
CNTR/I3=1;
CNTR2/I3=1;
END
TABLE FILE CAR
SUM CNTR2
BY COUNTRY
SUM CNTR
MODEL
BY COUNTRY
BY CAR
BY BODYTYPE
ON COUNTRY SUBFOOT
"[ST.CNTR2 CARS [ST.CNTR BODIES IN [COUNTRY"
END
I forget how to get the code to stick
November 03, 2006, 02:39 AM
Tony AOne thing we forget is that you are not restricted to using SQL only for SQL sources. And as, sometimes, SQL con provide an easier method of achieving things such as this you could resort to using SQL against the CAR file (or any other for that matter) -
-* File car_sql.fex
SQL
SELECT COUNT(CAR) AS CAR_COUNT
, COUNT(MODEL) AS MODEL_COUNT
, COUNTRY
FROM CAR
GROUP BY COUNTRY
;
TABLE
PRINT *
HOLD AS SQLOUT
END
TABLE FILE SQLOUT
SUM MAX.CAR_COUNT
MAX.MODEL_COUNT
BY COUNTRY
END
T
November 03, 2006, 04:57 PM
MadamZuZuThanks!