I have written the following two queries:
SELECT comaster.county, AVG(comaster.hour_rate) as avgrate, COUNT(comaster.co_number) as sumzero
WHERE comaster.hour_rate > 0
FROM comaster
GROUP BY comaster.county
ORDER BY comaster.county
SELECT COUNT(comaster.co_number) as sumall
FROM comaster
GROUP BY comaster.county
ORDER BY comaster.county
The first query selects all the records that have an hourly rate that is greater than zero and returns the average hourly rate, the number of companies in the county that have an hourly rate greater than zero, and the county name.
The second query counts the total number of records in the database. How do I combine both queries so that the query returns :
all the records that have an hourly rate that is greater than zero and returns the average hourly rate, number of companies in a county with hourly rates greater than zero, the county name PLUS the total number of companies in that county (regardless if the hourly rate is > 0 or not)?
Please let me know if I need to clarify.
Thanks!
[This message has been edited by crhodus (edited 11-13-2001).]
[This message has been edited by crhodus (edited 11-13-2001).]
SELECT comaster.county, AVG(comaster.hour_rate) as avgrate, COUNT(comaster.co_number) as sumzero
WHERE comaster.hour_rate > 0
FROM comaster
GROUP BY comaster.county
ORDER BY comaster.county
SELECT COUNT(comaster.co_number) as sumall
FROM comaster
GROUP BY comaster.county
ORDER BY comaster.county
The first query selects all the records that have an hourly rate that is greater than zero and returns the average hourly rate, the number of companies in the county that have an hourly rate greater than zero, and the county name.
The second query counts the total number of records in the database. How do I combine both queries so that the query returns :
all the records that have an hourly rate that is greater than zero and returns the average hourly rate, number of companies in a county with hourly rates greater than zero, the county name PLUS the total number of companies in that county (regardless if the hourly rate is > 0 or not)?
Please let me know if I need to clarify.
Thanks!
[This message has been edited by crhodus (edited 11-13-2001).]
[This message has been edited by crhodus (edited 11-13-2001).]