tags:

views:

530

answers:

3

Say I want to select rows with a date range or date_feild > 2009-06-01 && date_field < 2009-07-01. and I want to select the first_name_field and last_name_field but I only want the same name (F+L) to show up once per date. So the same name can show up, multiple times as long as their dates are different; but not if the names are on the same date. Does that makes sense? we are trying to track how many inquiries we got over a time period, but if the same user made multiple inquiries on the same day we want to count that as just 1.

I haven't even starting to program this yet so I am open to all suggestions.

Thanks!

+2  A: 

use GROUP BY

SELECT date,name FROM table GROUP BY date,name
duckyflip
A: 

Don't know in mySQL but in SQL Server you can use COUNT DISTINCT.

SELECT
    date_field,
    COUNT(DISTINCT first_name + last_name)
FROM
    YourTable
GROUP BY
    date_field
Robin Day
A: 

The answer is inside your question:

select distinct date, concat(first_name, ' ', last_name) from table
Bogdan Gusiev