categoryId parentId alias
Categories have parentId equal to zero, subcategories — equal to categoryId of their parent.
How do I retrieve a subcategory using CActiveRecord, if I know aliases of both category and subcategory? I need an equialent of the following SQL query:
SELECT s.* FROM tbl_category AS s
WHERE s.alias LIKE 'subcategoryAlias' AND
s.parentId = (SELECT categoryId FROM tbl_category WHERE parentId = 0 AND alias LIKE 'categoryAlias')

Help













