bbram Posted September 13, 2020 Share Posted September 13, 2020 Joins in general are still hard for me to figure out, and I don’t know why. I have the following code in my PHPMyAdmin console, and keep getting an error message: select DISTINCT login.username, login.login_time, players.Player_ID, players.Player_name, players.Player_First_Name, Players.Player_Last_Name, players.player_email INNER JOIN players on login.username=players.Player_ID where login.login_time > ‘2019-09-09’ Basically I am trying to figure out the last people that have logged in to our system within the past year and then will max it out to a certain number like 1000, or 500 depending on what mail server we use. Any help is greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/311477-distinct-values-with-joins/ Share on other sites More sharing options...
Barand Posted September 13, 2020 Share Posted September 13, 2020 This is your query in a more readable form select DISTINCT , login.username , login.login_time , players.Player_ID , players.Player_name , players.Player_First_Name , Players.Player_Last_Name , players.player_email INNER JOIN players on login.username=players.Player_ID where login.login_time > ‘2019-09-09’ It is missing "FROM login" where I left the empty line before "INNER JOIN". Your date needs to be inside plain single quotes (not the single inverted quotes that your editor has used). Are you sure you want to be joining a username with an id (usually numeric)? If none of those help, show us the error message your are getting. Quote Link to comment https://forums.phpfreaks.com/topic/311477-distinct-values-with-joins/#findComment-1581345 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.