I have a two tables as authors and articles. I want to get list of latest articles for each author. I want only one article for one author. And I want it to be the latest. But, I couldn't even figure out where to start to this sql query.
Edit
My table structure can be simplefied like this:
authors:
id
name
status
seo
articles:
author_id
title
text
date
seo
Edit 2
I came up with something like this, is there any obvious mistakes you can see in here:
SELECT authors.*,
(SELECT articles.title FROM articles WHERE author_id = authors.id ORDER BY articles.date DESC LIMIT 1) as title,
(SELECT articles.seo FROM articles WHERE author_id = authors.id ORDER BY articles.date DESC LIMIT 1) as articleseo
FROM authors
WHERE authors.status = 1
Alright, I found out what I needed to do:
I hope this helps someone.
I'll do something like that, but if you post the database structure I'll be more specific
No clue what your table structure is, but if it's what I envision then do this: