brownstone4 Posted December 27, 2012 Share Posted December 27, 2012 Hi, So when a user (joomla) is deleted their name, userid is removed from the jos_community_users table. However I have some extensions that keep content from that deleted user. I want to run query to see which content is left behind so I can manually delete it. I had read that maybe a JOIN query should be run but I am not sure how to write the query. Basically I need to compare for example the jos_blah_comments table which has row 'created by' with the userid numbers. I would like to compare this with jos_community_users row 'userid' and have the query show which comments have no user anymore. Any help would be appreciated, Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/272392-phpmyadmin-query-userid-content/ Share on other sites More sharing options...
Jessica Posted December 27, 2012 Share Posted December 27, 2012 Try like this SELECT jos_blah_comments.fields FROM jos_blah_comments LEFT JOIN jos_community_users ON jos_community_users.userid = jos_blah_comments.userid WHERE jos_blah_comments.userid IS NULL If that doesn't work, you'll have to do a subquery to find all the userids and do NOT IN. Quote Link to comment https://forums.phpfreaks.com/topic/272392-phpmyadmin-query-userid-content/#findComment-1401436 Share on other sites More sharing options...
brownstone4 Posted December 27, 2012 Author Share Posted December 27, 2012 (edited) Thank you that helped. Got it to work by changing it a bit to SELECT jos_blah_comments.created_by FROM jos_blah_comments LEFT JOIN jos_community_users ON jos_community_users.userid = jos_blah_comments.created_by WHERE jos_community_users.userid IS NULL Edited December 27, 2012 by brownstone4 Quote Link to comment https://forums.phpfreaks.com/topic/272392-phpmyadmin-query-userid-content/#findComment-1401443 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.