gpt4 book ai didi

mysql - 插入从表中选择一列

转载 作者:搜寻专家 更新时间:2023-10-30 19:56:40 27 4
gpt4 key购买 nike

我正在使用 Propel 2,我希望能够选择给定表中一列的值,等效的原始 SQL 查询如下所示:

select author_id from book_authors WHERE book_id = 111;

如果我写

BookAuthorsQuery::create()->findByAuthorId(111);

我将获得一个包含表中所有字段的数组对象,但我只是一个包含所选列的值的数组。

最佳答案

试试这个:

BookAuthorsQuery::create()->select(array('author_id'))->findByBookId(111);

propel 查询中的 ->select(array('author_id')) 为 propel 提供了您希望从表中选择的字段数组。

关于mysql - 插入从表中选择一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28753838/

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