[right]من یه کامند اس اکو ال رو در برنامه ام اجرا می کنم یعنی دستور زیررو [/right]
$connection = Yii::app()->db;
$queryb = "DROP TABLE if exists poli;";
$queryb .= "CREATE VIEW poli AS
SELECT `user_Id` , count( `psh_profile_information_services`.id ) as internetcount
FROM `psh_profile_information`
INNER JOIN `psh_profile_information_services` ON `psh_profile_information`.`id` = `psh_profile_information_services`.`profileInformationId`
WHERE `serviceId` =1
GROUP BY `psh_profile_information`.`user_Id` ";
$command= $connection->createCommand($queryb);
$command->execute();
$sql = "SELECT `profile`.`scope_id` , SUM( internetcount )
FROM `psh_profiles` AS profile
INNER JOIN `poli` ON `profile`.`user_id` = `poli`.`user_Id`
GROUP BY `profile`.`scope_id` ";
$internetcountOfRows = Yii::app()->db->createCommand($sql)->queryAll();
[right]بعد از اون از این جدول مجازی هم یک کوئری می گیرم و اونو اجرا می کنم دستورات من مشکل نداره ولی هر دو رو با هم اجرا نمی کنه و اکسپژن زیر رو میده[/right]
خطای CDbCommand در اجرای SQL statement: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.. The SQL statement executed was: SELECT `profile`.`scope_id` , SUM( internetcount )
FROM `psh_profiles` AS profile
INNER JOIN `poli` ON `profile`.`user_id` = `poli`.`user_Id`
GROUP BY `profile`.`scope_id
[right]
البته وقتی هم کد زیر رو قبل از
execute
نوشتم برنامه در یک حلقه بیهایت میفتاد و اصلا اجرا نمیشه چه کار می تونم بکنم
[/right]