Well, I strongly suggest that you have a backup before you try this, because I haven't tested it extensively. But first try this:
Code:
SELECT username, FROM_UNIXTIME(lastactivity) FROM user WHERE lastactivity < (UNIX_TIMESTAMP() - (86400 * X))
where you replace the red X with the number of days of inactivity. If this seems to select the right users, then you can do this:
Code:
DELETE FROM subscribethread WHERE userid IN (
SELECT userid FROM user WHERE lastactivity < (UNIX_TIMESTAMP() - (86400 * X))
)
replacing the X again.