query to get sales person and count of sales who did a sale each m

query to get sales person and count of sales who did a sale each m

Post by TmV0bW9 » Thu, 15 Jun 2006 11:40:01


I think you are asking for the number of sales per sales person from a given
date.

Having a column whose data type is date enables you to use logical operators
like <, >, <=, >= and = and not have to break up the date into parts.

select sales_person_id, count(sales_person_id) as 'Total Lots' from
sales_table where start >= '1/1/2004' group by sales_person_id

if you need the total for a month then add an extra condition to the where
clause. Example where for the month of january 2004, use start >= '1/1/2004'
and start < '2/1/2004'