General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Simple SQL Select issue
Environment versions
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only