MYSQL Query - Get latest comment related to the post

前端 未结 6 1052
刺人心
刺人心 2021-01-11 20:38

I am trying to get the latest 1 or 2 comments related to each post I download, a bit like instagram does as they show the latest 3 comments for each post, So far I am gettin

6条回答
  •  一个人的身影
    2021-01-11 21:24

    This will probably get rid of the illegal mix of collations... Just after establishing the connection, perform this query:

    SET NAMES utf8 COLLATE utf8_unicode_ci;
    

    For the question about the 'latest 2', please use the mysql commandline tool and run SHOW CREATE TABLE Posts and provide the output. (Ditto for the other relevant tables.) Phpmyadmin (and other UIs) have a way to perform the query without getting to a command line.

提交回复
热议问题