I’m having a problem performing a DATE_FORMAT() function on the “date” colum of a joined table… Maybe I’m saying it wrong or that doesn’t make sense so here is what I’m trying to do. I have a news table and an author table, I want to perform a date_format() on the date column of the news table, while joining it with the author table. originally I had this for query
$query = "SELECT * FROM news_test AS n, authors AS a WHERE n.auth_id = a.auth_id ORDER BY date DESC LIMIT 3";
So I went to add the date_format() and tried this…
$query = "SELECT DATE_FORMAT(date, '%M %e, %Y') as d, slug, body, auth_id, news_id, first_name, last_name FROM news_test AS n, authors AS a WHERE n.auth_id = a.auth_id ORDER BY date DESC LIMIT 3";
So I changed the * to every field from BOTH tables that I wanted to use… I think thats where the problem is, i might need to somehow differentiate between which table the colums are coming… maybe by using two “FROM” commands? here are my table settings, just in case that still doesn’t make sense.
news_test:
news_id
auth_id
slug
body
date
authors:
auth_id
first_name
last_name
webpage
email
bio
Thanks in advance for any help!