だから私は次のクエリを持っています:
public function findByDateCreated($date){
$select = $this->select();
$select->where('dtcreated = ?', $date);
$select->group('date');
$rows = $this->fetchAll($select);
if(count($rows) > 0){
return $rows[0];
}else{
return false;
}
}
エラーがスローされます:
500: SQLSTATE[42703]: Undefined column: 7 ERROR: column "date" does not exist LINE 1: ...E (dtcreated = '2012-10-17 14:26:41.575479') GROUP BY "date" ^
私の質問は:
次のように日付でグループ化するにはどうすればよいですか。
17-10-2012
One item
two item
three item
16-10-2012
oneitem
twoitem
threeitem
等々?
これがどのように役立つかわかりませんが、
create table users_notifications(
id int primary key default nextval('users_notifications_id_seq') not null,
userid int not null references users(id),
itemid int not null,
itemtype varchar(75),
dtcreated timestamp not null default now(),
dtupdated timestamp default now(),
message text,
flag boolean,
flagnew boolean
);
テーブルはこんな感じ。