Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple SQL Select issue
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01499700
Message ID:
01499701
Views:
55
Try
Sele epkey, count(DISTINCT date) from histwkrd where date between date1 and date2 group by epkey
>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
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform