I'm trying to get some information from several tables.
Basically I have 3 tables :
Call_Activity Table with 3 fields : Activity_ID, User_ID, Subject
User Table with 2 fields; User_ID, Name
PhoneCall Table with 2 fileds : Activity_ID, Complete_Flag
(there is more fields than that, but that's the ones I'm interrested in this particular case). I can't change the design of the database because I'm using an existing application and it's preconfigured database.
The idea that people are entering their phone activity in the base. When someone places a call it creates a new item in the Call_Activity table, linked to the user making that call (the user is listed in the User table). If the call is completed, the PhoneCall table set the Complete_Flag to true.
I want to get make a unique SQL query to display the following :
Expand|Select|Wrap|Line Numbers
- Names # of calls # of completed calls
- John 3 2
- Paul 12 10
User Table
Expand|Select|Wrap|Line Numbers
- User_ID Name
- 1 John
Expand|Select|Wrap|Line Numbers
- Activity_ID User_ID Subject
- 1 1 Call1
- 2 1 Call2
- 3 1 Call3
Expand|Select|Wrap|Line Numbers
- Activity_ID Complete_Flag
- 1 1
- 2 0
- 1 1
I've been trying different things with no luck.
Thanks!!