performance - MySQL - INNER JOIN - take only the last ID from the second table -


i need query 2 tables in mysql database. here short overview: 2 tables: articles , article_logs. have somethink 2700 articles , each article can have 20 50 logs. display each article last log date. problem query takes forever executed.

i trying somethin that:

select articles.id, article_logs.date articles left join ( select max(id), hash_key, date logs group id ) c  on article.hash_key = c.hash_key 

do have idea on how in proper , efficient way.

thank in advance.

maybe can try this:

select a.id,         (select max(l.date)         logs l         l.hash_key = a.hash_key) date articles 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -