Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Simple SQL Select issue
Versions des environnements
Network:
Windows 2003 Server
I think it must be Friday... as my mind has gone to lunch this afternoon. I know its only Thursday :)
I have a table with multiple records for employees and dates...
ie epkey 15, might have 4 records on date 1, 3 on date 2, etc...
I don't want to count the records, I want to count the dates...
ie if i just looking at date range between date 1 and 2, I don't want a count of the records, rather a count of the unique dates, ie 2 not 7.
A simple Select like this doesn't work.
Sele epkey, count(date) from histwkrd where date between date1 and date2 group by epkey
would return based on the above data, 7 where I would only to see the distinct dates ie, count those, not all the records.
I know I can do this with two queries, but is there a better way?
TIA,
Mike
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement