|
发表于 2009-4-22 22:30:05
|
显示全部楼层
$this->load->database();
$this->db->select('psku', 'pname', 'pcost', 'pprice', 'pskulist');
$this->db->from('products');
$this->db->where('pskulist<>', '""');
$query = $this->db->get();
$result = $query->result(‘array');
$result2 = array();
foreach($result as $res)
{
$sql = 'select sum(pprice) from products where psku in('.$res['pprice'].')';
$query = $this->db->query($sql);
$result2[] = $query->result('array');
}
print_r($result2);
仅供参考:) |
|