I want to use multiple table to get recent post (Q) and user name (handle) but when I am trying to get with this code it is giving error
Table Name qa_posts and qa_users and need to connect userid from qa_posts to handle from qa_users
SELECT *
FROM qa_posts, qa_users
WHERE type="Q" AND qa_posts.userid = "qa_users.handle"
ORDER BY created DESC
LIMIT 5
Error message
SELECT *
FROM qa_posts, qa_users
WHERE qa_posts.userid = "qa_users.handle"
ORDER BY created DESC
LIMIT 5
Error 1052: Column 'created' in order clause is ambiguous
Actual Code
qa_db_connection();
$query_post = qa_db_query_raw('
SELECT *
FROM qa_posts, qa_users
WHERE type="Q" AND qa_posts.userid = "qa_users.handle"
ORDER BY created DESC
LIMIT 5
') or die(mysql_error());
while($row = mysql_fetch_array($query_post)) {
echo $row['title'];
echo '<span style="font-size:65%;font-style:italic">'.$row['created'].'</span>';
echo '<br/>';
}
See this image for table structure