Welcome Guest, Not a member yet? Register   Sign In
What's wrong with this code? =/
#9

[eluser]Abel A.[/eluser]
Ok, that's pretty easy them.

You can either use the id or a timestamp as the index.

Code:
SELECT c.id, c.articleid, c.userid, c.commentbody, c.date, c.category, u.username, a.articleurl, a.articletype
FROM comments c
LEFT JOIN user u ON u.userid = c.userid
JOIN article a ON a.articleid = c.articleid
ORDER BY c.date DESC
LIMIT 5

Let me know if you have any questions with the above query.


Messages In This Thread
What's wrong with this code? =/ - by El Forum - 06-06-2012, 12:25 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 12:44 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 01:26 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 01:32 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 01:34 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 01:44 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 01:46 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 01:51 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 02:08 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 02:50 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 04:16 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 04:22 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 05:02 PM
What's wrong with this code? =/ - by El Forum - 06-06-2012, 05:45 PM



Theme © iAndrew 2016 - Forum software by © MyBB