gpt4 book ai didi

php - 如何优化kohana中的子查询

转载 作者:行者123 更新时间:2023-11-30 00:35:47 24 4
gpt4 key购买 nike

models.php

     ->add_subquery('(SELECT character_name FROM zid_character_details WHERE character_detail_id = (SELECT character_detail_id from zid_guild_feeds where feed_id = feeds.guild_parent_feed_id)) AS guildcharacter')
->add_subquery('(SELECT character_detail_id FROM zid_character_details WHERE character_detail_id = (SELECT character_detail_id from zid_guild_feeds where feed_id = feeds.guild_parent_feed_id)) AS guildcharacter_id')
->add_subquery('(SELECT character_icon FROM zid_character_details WHERE character_detail_id = (SELECT character_detail_id from zid_guild_feeds where feed_id = feeds.guild_parent_feed_id)) AS guildcharacter_icon')

上面是我用来从 zid_character_details 获取 character_namecharacter_detail_idcharacter_icon 的三个子查询> 引用 zid_guild_feeds 表的表。

谁能告诉我如何将这三个查询优化为单个或简单的查询。

谢谢

最佳答案

看看Kohana Query Builder JoinsKohana Query Builder Subqueries

当您需要探索各种 ORM 时,我建议您查看 Leap ORM

关于php - 如何优化kohana中的子查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22191450/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com