MySQL Forums
Forum List  »  General

MySQL query involving DATETIME
Posted by: Tylor Robinson
Date: May 14, 2014 06:13AM

Hello guys

I'm currently stuck with a mysql query i'm making that needs to retrieve data from a DATETIME column.I did now create the database,and am not allowed to change the datatype of a DATETIME FIELD

So far I have:

-------------------------------------------------------------------------------
SELECT
`call_completes`.`start` AS `Start(Call)`
, `re_agents`.`first_name` AS `Agent Name`
, `re_agents`.`last_name` AS `Agent Surname`
FROM
`db1`.`call_incompletes`, `db1`.`call_completes`,`db1`.`re_agents`
WHERE call_completes.start>=DATE(NOW())
AND call_completes.survey_id='532197e6-ed78-494e-9636-0586c56037f2'
AND re_agents.re_id='52f9f692-34b8-4937-87fb-561bc56037f2';
INNER JOIN `db1`.`call_completes`
ON (`call_incompletes`.`agent_ext` = `call_completes`.`agent_ext`)
INNER JOIN `db1`.`re_agents`
ON (`re_agents`.`extenstion_number` = `call_incompletes`.`agent_ext`)
LIMIT 1000;

-------------------------------------------------------------------------------


Now this is actually giving me a few issues.

When I recieve the results, they are all timed as 07:00:02 which is wrong as I need to retrieve all callstart results specifying their correct times

I also want to make this query dynamic, in the sence that the user shouldn't have to specify a date everytime he runs the query( instead it must just give me results for the day it gets run,inculding giving me the correct time each call was started.

Please advise as to what I should do

Options: ReplyQuote


Subject
Written By
Posted
MySQL query involving DATETIME
May 14, 2014 06:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.