Help us understand the problem. What is going on with this article?

sqlite3 で 最後に更新した行のデータを取得したい。

More than 1 year has passed since last update.

色々調べてみた結果。

IDを自動で入れていないとしても
挿入したデータの日付さえ入っていれば

SELECT max(date), <value1> FROM <TABLE>;

というSQL文で取得できる。
内容は簡単で、

date というカラムに入ってる
日付の情報を max(date) という
関数を使って、日付の数値が最大のもの=最新
の行を取得するという方法。

Google先生で検索したけどうまく引っかからなかったため、
備忘録も兼ねてメモしておくことに。

余談

SELECT * FROM <TABLE> ORDER BY <date_column> DESC LIMIT 5;

このSELECT文で最新から5つ取り出すとかできた。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away