There is a request of this kind
SELECT a.id, a.author, a.txt, a.timestamp, b.log, b.em
FROM txt_mesg a
LEFT JOIN users b
ON b.id = a.author
WHERE a.tid = '". $ Id."'
ORDER BY a.timestamp DESC
LIMIT 12 "
Messages are displayed in descending order of time, but it is necessary, in ascending order
How can you do this sorting?
Answer 1, authority 100%
Remove DESC
or replace it with ASC
(but not required)
SELECT a.id, a.author, a.txt, a.timestamp, b.log, b.em FROM txt_mesg a LEFT JOIN users b ON b.id = a.author WHERE a.tid = '". $ Id."' ORDER BY a.timestamp LIMIT 12 "
Answer 2, authority 50%
Apparently, you should also select the last 12 messages, but at the same time change their order. solved by another select level with a different sort:
SELECT *
FROM (
SELECT a.id, a.author, a.txt, a.timestamp, b.log, b.em
FROM txt_mesg a
LEFT JOIN users b ON b.id = a.author
WHERE a.tid = '". $ Id."'
ORDER BY a.timestamp DESC
LIMIT 12
) X
ORDER BY timestamp