Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从表中获取第一行和最后一行。一旦我明白了,我想从另一个表中获取另一个第一行和最后一行。
我觉得有些奇怪,但就是这样。
拜托,也许有人可以给我一个我想要的建议。
这就是我卡住的地方:
http://s14.postimage.org/sj9xgeofz/print.png
尝试使用这个: -
SELECT column name FROM table1 WHERE <conditions> ORDER BY date DESC LIMIT 1 UNION SELECT column name FROM table1 WHERE <conditions> ORDER BY date ASC LIMIT 1