>select COUND(DISTINCT(WO_NUMBER)) AS TOT_NUM from MyTable WHERE <SomeCondition> HAVING TOT_NUM > 5 >>
select COUNT(DISTINCT(WO_NUMBER)) AS TOT_NUM from MyTable WHERE <SomeCondition> HAVING COUNT(DISTINCT(WO_NUMBER)) > 5If you want the same code to be used in both VFP and SQL Server you can do
select * from (select COUNT(DISTINCT(WO_NUMBER)) AS TOT_NUM from MyTable WHERE <SomeCondition>) X WHERE TOT_Num > 5