所以我有以下查询:
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
);
这就是桌子的样子。