开发者

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

开发者 https://www.devze.com 2023-03-09 18:55 出处:网络
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 B

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

精彩评论

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