开发者

ZF_DB: how to make simple select for two or more tables without join?

Example:

SELECT `cat`.`id_catalog`, COUNT(parent.id_catalog) - 1) AS `level` FROM `tbl_catalog` AS `cat`, `tbl_catalog` AS `parent` WHERE (cat.`left` BETWEEN parent.`left` AND parent.`right`) GROUP BY `cat`.`id_catalog` ORDER BY `cat`.`left` ASC

It doesn't seem to work if it use ZF. ZF create this query with join only. How to create the select without join in ZF_DB.

By the way may be I do smth wrong in this query. It is simple nested set DB with parent, left and right fields. Perhaps there are another way to use join to get deep for some node. Anyway it would be interesting to get answer for both way:)

Thanks in adv开发者_如何学编程ance to all who looks it through:)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜