Was wondering if people could give me a hand here. I am currently updating some SQL code for a plugin I maintain, and I have hit a problem.
What I am trying to do is fetch data from one table, join it with another and then return the data to my PHP app. That is working, however - I want to order the data returned in descending order - this is proving difficult and doesn't seem to want to play ball.
SELECT DISTINCT s.userid, s.id, u.user_nicename, u.user_login, u.display_name, u.id
FROM wp_bbpas as s INNER JOIN wp_users as u
ON s.userid = u.id
ORDER BY s.id DESC
That returns everything in wp_bbpas
and joins it with the wp_users
table, but I actually only want to grab unique/distinct values.
Am I doing something wrong here?