TDbCommand failed to execute the query SQL "SELECT sp.*, spd.title, spd.short_description, spd.description, spd.warranty, spp.name as producer_name, (SELECT spc1.category FROM shop_product_categories spc1 INNER JOIN shop_category_to_product sctp1 ON sctp1.id_category = spc1.id_category WHERE spc1.parent_category = 0 AND sctp1.id_product = sp.id_product) as main_category, (SELECT spc2.category FROM shop_product_categories spc2 INNER JOIN shop_category_to_product sctp2 ON sctp2.id_category = spc2.id_category WHERE spc2.parent_category != 0 AND sctp2.id_product = sp.id_product) as subcategory, CAST(REPLACE(REPLACE(REPLACE(sptp_szer.property_value, ",", "."), "cm", ""), " ", "") as DECIMAL(11,2)) as szerokosc, IF(new_price = 0, price, new_price) as cena, CAST(REPLACE(REPLACE(REPLACE(sptp_dl.property_value, ",", "."), "cm", ""), " ", "") as DECIMAL(11,2)) as dlugosc, CAST(REPLACE(REPLACE(REPLACE(sptp_wys.property_value, ",", "."), "cm", ""), " ", "") as DECIMAL(11,2)) as wysokosc FROM shop_products sp LEFT JOIN shop_product_details spd ON sp.id_product = spd.id_product LEFT JOIN shop_product_producers spp ON spp.producer_id = sp.producer LEFT JOIN shop_property_to_product sptp_dl ON sptp_dl.id_product=sp.id_product AND sptp_dl.id_p_property = 1 LEFT JOIN shop_property_to_product sptp_wys ON sptp_wys.id_product=sp.id_product AND sptp_wys.id_p_property = 2 LEFT JOIN shop_property_to_product sptp_szer ON sptp_szer.id_product=sp.id_product AND sptp_szer.id_p_property = 3 WHERE trash!='y' AND sp.id_product = '26' ORDER BY id_product DESC LIMIT 1": SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row
/home/web/sites/gzyms.pl/framework_3_1_10/Data/TDbCommand.php (257)
0246: // Prado::trace('Query Row: '.$this->getDebugStatementText(), 'System.Data');
0247: if($this->_statement instanceof PDOStatement)
0248: $this->_statement->execute();
0249: else
0250: $this->_statement=$this->getConnection()->getPdoInstance()->query($this->getText());
0251: $result=$this->_statement->fetch($fetchAssociative ? PDO::FETCH_ASSOC : PDO::FETCH_NUM);
0252: $this->_statement->closeCursor();
0253: return $result;
0254: }
0255: catch(Exception $e)
0256: {
0257: throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText());
0258: }
0259: }
0260:
0261: /**
0262: * Executes the SQL statement and returns the value of the first column in the first row of data.
0263: * This is a convenient method of {@link query} when only a single scalar
0264: * value is needed (e.g. obtaining the count of the records).
0265: * @return mixed the value of the first column in the first row of the query result. False is returned if there is no value.
0266: * @throws TDbException execution failed
0267: */
0268: public function queryScalar()
0269: {
#0 /home/web/sites/gzyms.pl/framework_3_1_10/Data/DataGateway/TDataGatewayCommand.php(293): TDbCommand->queryRow()
#1 /home/web/sites/gzyms.pl/framework_3_1_10/Data/ActiveRecord/TActiveRecordGateway.php(236): TDataGatewayCommand->findBySql(Object(TActiveRecordCriteria))
#2 /home/web/sites/gzyms.pl/framework_3_1_10/Data/ActiveRecord/TActiveRecord.php(662): TActiveRecordGateway->findRecordBySql(Object(ShopProductsRecord), Object(TActiveRecordCriteria))
#3 /home/web/sites/gzyms.pl/protected/Pages/Produkt.php(210): TActiveRecord->findBySql('SELECT\n\t\t\t\t\tsp....')
#4 /home/web/sites/gzyms.pl/protected/Pages/Produkt.php(317): Produkt->getProductWithLink('26')
#5 /home/web/sites/gzyms.pl/protected/Pages/Produkt.php(40): Produkt->loadProduct()
#6 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TControl.php(1270): Produkt->onInit(NULL)
#7 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TCompositeControl.php(35): TControl->initRecursive(NULL)
#8 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TTemplateControl.php(240): TCompositeControl->initRecursive(NULL)
#9 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TPage.php(207): TTemplateControl->initRecursive()
#10 /home/web/sites/gzyms.pl/framework_3_1_10/Web/UI/TPage.php(198): TPage->processNormalRequest(Object(THtmlWriter))
#11 /home/web/sites/gzyms.pl/framework_3_1_10/Web/Services/TPageService.php(498): TPage->run(Object(THtmlWriter))
#12 /home/web/sites/gzyms.pl/framework_3_1_10/Web/Services/TPageService.php(444): TPageService->runPage(Object(Produkt), Array)
#13 /home/web/sites/gzyms.pl/framework_3_1_10/TApplication.php(1095): TPageService->run()
#14 /home/web/sites/gzyms.pl/framework_3_1_10/TApplication.php(382): TApplication->runService()
#15 /home/web/sites/gzyms.pl/index.php(49): TApplication->run()
#16 {main}