$now = time();
$year[] = (date('Y',time()))-2;
$year[] = (date('Y',time()))-1;
$year[] = (date('Y',time()));
$mon = array(1,4,7,10);
//组装近三年每个季度的节点
foreach ($year as $v){
foreach ($mon as $j){
$node_str[] = "'".$v."-".$j."'";
}
}
for ($k=1;$k<count($node_str);$k++){
//根据时间节点循环查询
$data[] = $db->select("select * from table1 where time between ".$node_str[$k-1]." and ".$node_str[$k]);
}