larry98765
Registered
Hi All,
I have a table called "articles." Each article has a date field called "pubdate" -- the article's date of publication. Many articles share the same publication date.
I need to perform the following sql query:
"Show me ONLY the articles with the most recent pubdate."
So the query should be something like this:
SELECT *
FROM articles
WHERE pubdate =
'SELECT pubdate
FROM articles
ORDER BY pubdate DESC
LIMIT 1'
This SHOULD select all the pubdates, order them and limit to the first (that's the most recent article.) Then the outer select should find me all the articles that are also published on that date.
I know the data is there, but this query yields no results. I think there's a syntax problem, but I'm not sure where.
Any ideas?
Thanks
I have a table called "articles." Each article has a date field called "pubdate" -- the article's date of publication. Many articles share the same publication date.
I need to perform the following sql query:
"Show me ONLY the articles with the most recent pubdate."
So the query should be something like this:
SELECT *
FROM articles
WHERE pubdate =
'SELECT pubdate
FROM articles
ORDER BY pubdate DESC
LIMIT 1'
This SHOULD select all the pubdates, order them and limit to the first (that's the most recent article.) Then the outer select should find me all the articles that are also published on that date.
I know the data is there, but this query yields no results. I think there's a syntax problem, but I'm not sure where.
Any ideas?
Thanks