יצרתי סקריפט אבל אני מקבל הודעת שגיאה. אשמח לקבל משוב/עצה

The problem is that none of those tables exist. FROM pr means to select rows from the table pr but there is no table pr in Discourse.

Maybe you meant posts or topics ? Ditto for every other join, none of those tables exist.