Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coparing dates from two tables output the most recent record 1

Status
Not open for further replies.

mperez5

Programmer
Nov 17, 2002
15
0
0
US
How would I be able to query my database and get the record
that is the most recent from two tables. Any help would be greatly appreaciated.

select m.multimedia_ID, m.ReleaseDate, m.status,
News.ArticleID, News.ReleaseDate,News.status
from multimedia, NewsFeatures
where m.ReleaseDate <= now() OR
m.ReleaseDate <= now()

Output:
240 01-09-06 first
 
I am not a SQL expert but you could look up LIMIT and ORDER BY. I think they would help you in this case.

- Zych
 
select * from (
select m.multimedia_ID
, m.ReleaseDate
, m.status
from multimedia as m
where m.ReleaseDate <= now()
union all
select News.ArticleID
, News.ReleaseDate
, News.status
from NewsFeatures as News
where News.ReleaseDate <= now()
) as data
order by ReleaseDate desc limit 1

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top