*Chuckling*...ok, it's been a long day.

Try this one last time.

You will need to break this select statement apart into sub selects to get the correct answers.

Your having clauses are most likely not correct, or not doing what you think they are.

A few mor assumptions here -

Are you trying to count the following:

All records in tbl_BizContact and the column biz_id the primary key?
All records in tbl_BizContact where biz_name IS NOT NULL ?
All records in tbl_Survey2006 where foss_supt_biz is TRUE?
The average of all values in the column tbl_Survey2006.biz_age?

If the answer to all of the above is YES then this is actually a query made up of 4 sub-select statements. Each getting the one aggregate value, as each could run across a variable number of records.

SELECT
  "tmp1"."ContactRecords" AS "ContactRecords",
  "tmp2"."ContactNames" AS "ContactNames",
  "tmp3"."AverageAge" AS "AverageAge",
  "tmp4"."fossSuptCnt" AS "fossSuptCnt"
FROM
  ( SELECT
      COUNT( "tbl_BizContact"."biz_id" ) AS "ContactRecords",
  FROM "tbl_BizContact"
  ) "tmp1"
  ,
  (SELECT
      COUNT( "tbl_BizContact"."biz_name )
  FROM "tbl_BizContact"
  WHERE "biz_name" IS NOT NULL
  ) "tmp2"
  ,
  (
  SELECT
      AVG( "tbl_Survey2006"."biz_age") AS "AverageAge",
  FROM "tbl_Survey2006"
  ) "tmp3"
  ,
  (SELECT
      COUNT( "tbl_Survey2006"."foss_supt_biz" ) AS "fossSuptCnt"
  FROM "tbl_Survey2006"
  WHERE "foss_supt_biz"  = TRUE
  ) "tmp4



Sorry, for the earlier emails - I was just letting my fingers get ahead of my brain.

Reply via email to