Jump to content

Phpmyadmin Query Userid Content


brownstone4

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/272392-phpmyadmin-query-userid-content/
Share on other sites

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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.