View Full Version : MySQL Comparison

08-22-2009, 08:59 PM
Ok so I have this database that I want to compare and display data from it. What I have is two tables. One that is called "calls" and the other is called "calls_cstm". Here is a print out of both:

INSERT INTO `calls` (`id`, `name`, `date_entered`, `date_modified`, `modified_user_id`, `created_by`, `description`, `deleted`, `assigned_user_id`, `duration_hours`, `duration_minutes`, `date_start`, `date_end`, `parent_type`, `status`, `direction`, `parent_id`, `reminder_time`, `outlook_id`) VALUES
('ec17e8ed-6760-3183-7938-4a847f4b36e8', 'Toques Finales', '2009-08-13 21:02:09', '2009-08-19 18:43:01', '1', '1', 'Furniture company, they can be offered an online product catalog that they can edit and replace product in as much as they want.', 0, '8ffd3d87-86c6-c88f-2a3a-4a8473cf78f9', 0, 15, '2009-08-24 15:00:00', '2009-08-24', 'Leads', 'Planned', 'Outbound', '3c834a37-e3de-ca6a-8726-4a847e17a77c', 3600, NULL)

INSERT INTO `calls_cstm` (`id_c`, `call_time_c`, `phone_c`) VALUES
('ec17e8ed-6760-3183-7938-4a847f4b36e8', '0:00', '2368-0720')

Ok here is what we have. Calls is the list of the calls the person has to make and calls_cstm is the list of custom values I have made for each call. Like Phone Number and the other one is Call Time (The time the caller was on the phone.) What I want to do is run a script that prints out all calls made on a certain date that I enter and only on that date and then add up all the call times for each one of the printed calls and display a total time taken for that day. The time is in the format of MM:SS. And I want it to print out the total time in the same format and of course if added up goes into hours then that too.

The problem is I'm not good at all with dates and times in MySQL or PHP if someone could give me a hand please with this code? Thanks for any assistance.

Basically I want it to make a sort of time report you could say.