I have a message table :
CREATE TABLE OneToOneMessages (
MessageID int NOT NULL AUTO_INCREMENT,
AuthorID int NOT NULL,
RecipientID int NOT NULL,
MessageText TEXT,
SentTime DATETIME,
PRIMARY KEY (MessageID),
FOREIGN KEY (AuthorID) REFERENCES Users(ID),
FOREIGN KEY (RecipientID) REFERENCES Users(ID)
);
I need to get the latest message from every conversation in order. I've found some queries online but I have no idea how they work and am not sure they get the job done.
I think I could just go one by one, getting the last message from each conversation and then sorting them by the sent time. If there was one query I could use that gets all the information, that would be best.