我有这个查询
SELECT * FROM Posts WHERE Topics = '2hnsk6i2iqgoh0c6kdbyd' ORDER BY Number DESC limit 0,25
这将导致以下结果
2hnsk6i2iqgoh0c6kdbyd admin coecxrj0vqkow46h6243v 17:28 2013/01/02 1357147682
2hnsk6i2iqgoh0c6kdbyd admin uvde2od4fffjyri2se3v6 17:28 2013/01/02 1357147682
2hnsk6i2iqgoh0c6kdbyd admin 7nvk4tamdcmmqxc8xxzns 17:28 2013/01/02 1357147682
2hnsk6i2iqgoh0c6kdbyd admin 46ibv785bpbcqin5csgqt 17:28 2013/01/02 1357147681
2hnsk6i2iqgoh0c6kdbyd admin nprsukm2v7adx62psizcn 17:28 2013/01/02 1357147681
2hnsk6i2iqgoh0c6kdbyd admin 5jffjmcrywv28ypxf88m8 17:28 2013/01/02 1357147681
2hnsk6i2iqgoh0c6kdbyd admin i5ejx2hqf7m6m4ybc0b43 17:28 2013/01/02 1357147680
2hnsk6i2iqgoh0c6kdbyd admin m72qzizi0ru4z6e2vz6vq 17:28 2013/01/02 1357147680
2hnsk6i2iqgoh0c6kdbyd admin 3mf83zzvow6wt2gfhb6ub 17:28 2013/01/02 1357147680
2hnsk6i2iqgoh0c6kdbyd admin ct2j2u8xx8ny8x3u27sjc 17:27 2013/01/02 1357147679
2hnsk6i2iqgoh0c6kdbyd admin sdbx6iyburbeg0ie0magt 17:27 2013/01/02 1357147679
2hnsk6i2iqgoh0c6kdbyd admin 5hir63ok3kq06g3upqbhk 17:27 2013/01/02 1357147679
2hnsk6i2iqgoh0c6kdbyd admin 4pvuwgqazd84yck7adoxa 17:27 2013/01/02 1357147678
2hnsk6i2iqgoh0c6kdbyd admin oiv6quuyrpwe8bgirjr4i 17:27 2013/01/02 1357147678
2hnsk6i2iqgoh0c6kdbyd admin xcutah6426zesq323gfwx 17:27 2013/01/02 1357147678
2hnsk6i2iqgoh0c6kdbyd admin hgfqab040h4k55bjedpkt 17:27 2013/01/02 1357147678
2hnsk6i2iqgoh0c6kdbyd admin oonp5r3np5knm5d4ohm55 17:27 2013/01/02 1357147677
2hnsk6i2iqgoh0c6kdbyd admin cbckqm8qi2oaimir2epzi 17:27 2013/01/02 1357147677
2hnsk6i2iqgoh0c6kdbyd admin vtsaqex6wfdmh8ioceuvn 17:27 2013/01/02 1357147677
2hnsk6i2iqgoh0c6kdbyd admin 0ubs8ur2wo55ohfuipdo0 17:27 2013/01/02 1357147677
2hnsk6i2iqgoh0c6kdbyd admin 8tvorn65epoaict0fp26z 17:27 2013/01/02 1357147676
2hnsk6i2iqgoh0c6kdbyd admin soctqr26i7aycza2u73pi 17:27 2013/01/02 1357147676
2hnsk6i2iqgoh0c6kdbyd admin 8ukjwmao2qtt374g6p7ej 17:27 2013/01/02 1357147676
2hnsk6i2iqgoh0c6kdbyd admin 4wyinun2ki45h6ww73qg6 17:27 2013/01/02 1357147675
2hnsk6i2iqgoh0c6kdbyd admin 3dpsbg2t7s7fj2hbiyenk 17:27 2013/01/02 1357147675
这会在某个主题中显示论坛帖子,但是说用户正在查看帖子历史记录,并希望使用它来访问该主题,我想要一些代码,例如
SELECT *
FROM Posts
WHERE Topics = '2hnsk6i2iqgoh0c6kdbyd'
ORDER BY Number DESC limit (SELECT * FROM POSTS WHERE POST = 'soctqr26i7aycza2u73pi'),25.
那当然行不通,但是我不知道您是否可以,如果可以,我将如何使那段代码正常工作
由于存在一些混乱,我会尝试简化它。
我想运行查询 Topics = '$topic' 然后在那个 pull Post = '$post' 中,这将返回一个值,我希望在 Limit 中使用它的行号作为起点返回数据或本质上相似的代码来做同样的工作
MySQL 版本 5.5.29-日志