2009-04-16から1日間の記事一覧

UNIONでテーブルを連結して検索するサンプルクエリ

SQL

hoge0とhoge1テーブルあったとする。 それぞれをdatesフィールドで降順ソートし、連結して先頭から5件を取得するサンプル。 ( SELECT no, name, dates, 0 //※ FROM hoge0 ORDER BY dates DESC ) UNION ALL ( SELECT no, name, dates, 1 //※ FROM hoge1 ORDER…

日付メモ

{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'} ↓ 2009-04-16 16:42:05 formで使うサンプル <input type="text" name="datetimes_y" size="4" maxlength="4" value="{~$smarty.post.datetimes_y|escape|default:($smarty.now|date_format:'%Y')~}" />年