Skip to content

Instantly share code, notes, and snippets.

@AKB428
Last active November 8, 2015 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AKB428/b7451010a9cae1edf906 to your computer and use it in GitHub Desktop.
Save AKB428/b7451010a9cae1edf906 to your computer and use it in GitHub Desktop.
MySQL と MariaDBの プリペアドステートメント バインドパラメーターがSQL関数だった時の挙動の違い ref: http://qiita.com/AKB428/items/8be7059e7e2919cea090
SELECT h.follower, h.updated_at
from twitter_status_histories as h,
(SELECT id FROM bases WHERE twitter_account = 'usagi_anime' order by id desc limit 1) b
where h.bases_id = b.id AND h.updated_at < ? order by h.updated_at desc limit 100
SELECT h.follower, h.updated_at
from twitter_status_histories as h,
(SELECT id FROM bases WHERE twitter_account = 'usagi_anime' order by id desc limit 1) b
where h.bases_id = b.id AND h.updated_at < 'now()' order by h.updated_at desc limit 100
follower updated_at
51345 2014-09-23 18:53:27
50606 2014-09-14 14:55:02
50607 2014-09-14 14:50:04
46350 2014-08-11 16:44:05
follower updated_at
51345 2014-09-23 18:53:27
50606 2014-09-14 14:55:02
50607 2014-09-14 14:50:04
46350 2014-08-11 16:44:05
Empty set, 1 warning (0.00 sec)
SELECT h.follower, h.updated_at
from twitter_status_histories as h,
(SELECT id FROM bases WHERE twitter_account = 'usagi_anime' order by id desc limit 1) b
where h.bases_id = b.id AND h.updated_at < now() order by h.updated_at desc limit 100
| 133727 | 2015-11-07 12:00:06 |
| 133717 | 2015-11-07 11:30:07 |
| 133707 | 2015-11-07 11:00:07 |
| 133701 | 2015-11-07 10:30:06 |
| 133727 | 2015-11-07 12:00:06 |
| 133717 | 2015-11-07 11:30:07 |
| 133707 | 2015-11-07 11:00:07 |
| 133701 | 2015-11-07 10:30:06 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment