My query below is:
Code: Select all
<?php
$GetAppeals2 = mysql_query("SELECT RecordID,ReportedPlayer,FrozenBy,Reason FROM reportedusers WHERE EXISTS
(SELECT SaidBy FROM reportsituation WHERE NOT EXISTS
(SELECT UserID FROM Staff WHERE reportsituation.SaidBy = staff.UserID AND reportedusers.RecordID <> reportsituation.RecordID)
GROUP BY RecordID ORDER BY SaidTime ASC)")
or die(mysql_error());
?>Get RecordID,ReportedPlayer,FrozenBy,Reason from reportedusers. If the following statement is found:
Where the "SaidBy" field from reportsituation table is NOT found in the "Staff" table by checking staff.UserID.
And also where RecordID "IS" found in the reportsituation table which is done by reportedusers.RecordID <> reportsituation.RecordID. As that is in the "NOT EXISTS" it creates the opposite of what its doing if you get me?
Try to imagine RecordID from reportedusers table as the "forum thread" then the RecordID's in the reportsituation is all the posts withing that thread. And they need the RecordID so the script knows where they are linked to. Now i need to get the "most recent" or in my case "most recent message" which is logged by "SaidTime" which is a time stamp.
Sorry if my explanation is poor im still learning mysql.. and this is getting quite complicated for me so hope some one can help me out