加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

zend-framework – Zend DB选择常量 – 表中不存在的列

发布时间:2020-12-13 16:37:25 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试使用Zend DB select进行此查询,但我无法做到这一点 这是sql查询 select shopping_id,shopping_details,"friend" as typefrom shopping 请注意,我如何指定“朋友”作为类型,而朋友不是购物表中的列. 现在我在Zend如何做到这一点.我试过这个,但是给
我正在尝试使用Zend DB select进行此查询,但我无法做到这一点

这是sql查询

select shopping_id,shopping_details,"friend" as type
from shopping

请注意,我如何指定“朋友”作为类型,而朋友不是购物表中的列.

现在我在Zend如何做到这一点.我试过这个,但是给我一个错误,说“sh.friend列不存在”

$select->from(array('sh'=>'shopping'),array('shopping_id','shopping_details','"friend" as type');

任何帮助将不胜感激
谢谢

尝试使用Zend_Db_Expr,或许像:
$select->from(array('sh'=>'shopping'),new Zend_Db_Expr('"friend" as type'));

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读