B
B
byms2014-10-28 09:02:22
Yii
byms, 2014-10-28 09:02:22

Distinct product sizes. How to implement in yii?

In the category, I pulled out products by category_id, the product has a modification table (id, catalog_id, size_id, count) and a size table (id, size) for the filter, you need to pull out sizes without repetitions. dbdsgnr.appspot.com/app#agdkYmRzZ25ycg8LEgZTY2hlbW... . How about to implement?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zohei, 2014-11-05
@Zohei

select size from products group by size
either way

$criteria = new CDbCriteria;
$criteria->select = ['id',size'];
$criteria->group = 'size';
$sizes = Products::model()->findAll($criteria);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question