好的女士们,我真的很感激一些帮助:
这是我的表:
ID postID replyID content entry_date 1 0 40 hey 12/7 2 0 40 hi 12/8 3 0 40 whatsup 12/9 4 2 40 why? 12/10 5 0 40 who? 12/11
我需要运行一个查询来得到它:
ID postID replyID content entry_date 1 0 40 hey 12/7 2 0 40 hi 12/8 4 2 40 why? 12/10 3 0 40 whatsup 12/9 5 0 40 who? 12/11
您将看到ID 3和4已切换.所以基本上我需要通过entry_date进行ASC,除非ID = POSTID,然后我需要将这两个组合在一起,并且还需要通过entry_date对这两个进行ASC.
这是我尝试过但我完全迷失了:
SELECT t1.ID, t1.postID, t1.replyID, t1.content, t1.entry_date
FROM discussion t1, discussion t2
WHERE …Run Code Online (Sandbox Code Playgroud)