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.
我想构建一个mysql_query只给我一个新rows 插入的table带有一个where condition类似的......
mysql_query
rows
table
where condition
SELECT (LAST 5) FROM `x` WHERE `USER_KEY` = '$RK' ORDER BY `dd` DESC
之后这些数据将在 json 中解析,否则我只会得到所有数据并循环抛出。
您可以颠倒顺序并获得前 5 个。这与获得最后 5 个并反过来排序相同
SELECT * FROM `x` WHERE `USER_KEY` = '$RK' ORDER BY `dd` ASC limit 5
或者,如果您需要 desc 命令,您可以执行
select * from (SELECT * FROM `x` WHERE `USER_KEY` = '$RK' ORDER BY `dd` asc limit 5) as x order by `dd` desc