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.
私は.... のように a にmysql_query新しくrows 挿入されたものだけを提供する a を構築したいと思います。tablewhere 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
または、あなたができる降順が必要な場合
select * from (SELECT * FROM `x` WHERE `USER_KEY` = '$RK' ORDER BY `dd` asc limit 5) as x order by `dd` desc