Hello All,

Great list ! 
MySQL = Incredible Product !

I've been trying to come up with a SQL query to perform the following...

Table - Contact

ClientID
Activity1
Activity2
Activity3
Activity4
Time1
Time2
Time3
Time4
Date

I need to get a total of all the activities and their associated time between two 
dates 
and group them by ClientID

I came up with 

SELECT ActivityCode1, SUM(Time1) FROM Contact
WHERE (Date BETWEEN  '2002-01-01' AND '2002-12-15') 
GROUP BY  ActivityCode1, ORDER BY ClientID


If I execute the above for each of the 4 ActivityCodes & Time and add them 
manually I get the correct results, but I'm wondering if it could be done with one 
SQL statement.

any suggestions are greatly appreciated !!

Marko Palikko



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to