CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 3065 Expression #1 of ORDER BY clause is not in SELECT list, references column 'dascomla_sonaray_evolution.Product.score' which is not in SELECT list; this is incompatible with DISTINCT. The SQL statement executed was: SELECT distinct ptype.id type_id, pc.country_id, Product.name, ProductImage.path,ProductImage.id id_image, Product.id id_producto
FROM products Product
INNER JOIN products_images ProductImage ON(Product.id = ProductImage.product)
INNER JOIN products_products_type pptype on (Product.id=pptype.product)
INNER JOIN products_types ptype on (pptype.product_type=ptype.id)
LEFT JOIN products_countries pc on (Product.id=pc.product_id)
WHERE ProductImage.language = 'en' and pc.country_id = ''and active=1 AND ProductImage.category =0 and
(pc.country_id='' or pc.country_id is null ) order by Product.score asc

/home/dascomla/public_html/yii/framework/db/CDbCommand.php(543)

531         {
532             if($this->_connection->enableProfiling)
533                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
534 
535             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
536             $message=$e->getMessage();
537             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
538                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
539 
540             if(YII_DEBUG)
541                 $message.='. The SQL statement executed was: '.$this->getText().$par;
542 
543             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
544                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
545         }
546     }
547 
548     /**
549      * Builds a SQL SELECT statement from the given query specification.
550      * @param array $query the query specification in name-value pairs. The following
551      * query options are supported: {@link select}, {@link distinct}, {@link from},
552      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
553      * {@link limit}, {@link offset} and {@link union}.
554      * @throws CDbException if "from" key is not present in given query parameter
555      * @return string the SQL statement

Stack Trace

#1
+
 /home/dascomla/public_html/sonaray/protected/controllers/ProductsController.php(155): CDbCommand->queryAll()
150                     INNER JOIN products_products_type  pptype on (Product.id=pptype.product)
151                     INNER JOIN products_types  ptype on (pptype.product_type=ptype.id)
152                     LEFT JOIN products_countries pc on (Product.id=pc.product_id)
153                     WHERE  ProductImage.language = '" . $idioma . "'  and pc.country_id = '" . Yii::app()->request->cookies['flag']->value . "'and active=1 AND ProductImage.category =0 and
154                     (pc.country_id='" . Yii::app()->request->cookies['flag']->value . "' or pc.country_id is null ) order by Product.score asc ";
155         $Sqlimages = Yii::app() -> db->createCommand($sqlimg)->queryAll();
156         $sqlTypeProductImages = "SELECT pti.* FROM products_types_images pti
157                                     INNER JOIN products_types pt ON (pt.id = pti.product_type_id AND pt.visible = 1) ORDER BY pt.score ASC;";
158         $productTypesImages = Yii::app() -> db->createCommand($sqlTypeProductImages)->queryAll();
159         $model = new ContactForm();
160         // Para el manejo del envío de correo para contacto si en la petición incluye la variable post con información de contacto.
#9
+
 /home/dascomla/public_html/sonaray/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
14 
2024-03-28 10:39:35 Apache Yii Framework/1.1.16