Firstly let me explain what the order of the list should look like:
There is 2 tables.. one holds information about a reported player.. the other table holds messages between user and the staff member dealing with the user that was reported.
The list is then suppose to list ALL reports... in an order of priority.
If no one has made a message then they go at the top of the list. Followed by users who have posted and are awaiting to hear from a staff member. Then the last priority is the reports that the last message sent was by a staff member.
Please also notice each group is also individually sorted in ASC order.Awaiting Response
Awaiting Response
Awaiting Response
Last Response : User - 2 days ago
Last Response : User - 1 days ago
Last Response : User - 1 days ago
Last Response : Staff - 4 days ago
Last Response : Staff - 2 days ago
Last Response : Staff - 1 days ago
My tables are as follows:
ReportedSituation:
RecordID | SaidBy(ID) | Said Time | Message |
Staff table (for checking if user is a staff member of not for sorting):
UserID | StaffType |
SaidTime is the field i want to ASC order the list per group.
This was my attempt.. i am no expert but i gave it a go and had it half working...as it loaded a message lol But not all of them!
Hope you can help fix my mistake!
Query:
Code: Select all
$GetAppeals = mysql_query("select s.StaffType
, r.SaidBy
, r.SaidTime
, r.RecordID
from reportsituation as r
inner
join Staff as s
on s.UserID = r.SaidBy
order
by r.SaidBy = '' desc
, s.StaffType desc
, r.SaidTime desc")
or die(mysql_error());