MySQL Max is not selected the maximumn value with multiple joins -


I am trying to find the latest activity for our PBX grave reporting from some crashes. I have the following code that gives me a brilliant view of all the tasks for every agent today:

  select e.`event_id`, event_time` like event_time, eg_event_id, p. Agent_id`, `a_name`,` a_number` to `c2g` .`events` and 'event_parties` in the form of' p_event_id` = p.`g_event_id` Leave p 'agent` in the form of p.agent_id Skip = A.agent_id, where p.agent_id is not zero and p.agent_id & lt; & Gt; 0 order event_time desc;   

and the following code which will give me the latest event for each agent:

  Select e.`event_id`, MAX (`event_time`) such as- Event_time, eg_evant_id, p. Rajendra_i, `a_name`,` a_number` as `c2g` ._events` and when joining 'event_parties`, e.` P_event_id` = p.`g_event_id` left p` agent` p.agent_id = a. Join as agent_id, where p.agent_id is not empty and p.agent_id & lt; & Gt; A_name 0 Group by ACA order by ACA;   

Although I'm not really getting the latest event, I've got one recently, but always many new programs are ignored. Why any thoughts are happening?

Try it

  E.event_id`, E.`event_time`, e_event_id, p.agent_id`, `a_name`,` a_number` to `c2g`. Leave as 'Events' and 'event_parties' as e on P. Leave `G_event_id` = p.`g_event_id`` as agent` p.agent_id = a.agent_id, where p.agent_id is not zero and p.agent_id & lt; & Gt; E by Grandmaster E. `Avent_time` DESC serious 0,1;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -