$command=Yii::app()->db->createCommand();
$command->select('SUM(amount) AS sum');
$command->from('sale_info');
$command->where('user_id='.$_GET['users'].' AND ratingtyle="Initial"');
$command->andWhere('created_date>:start', array(':start' => $_GET['startdate']));
$command->andWhere('created_date<:end', array(':end' => $_GET['enddate']));
echo 'Initial Fee: '.$command->queryScalar();
No comments:
Post a Comment