如何使此查询返回特定列的结果
我有一个如下查询:-
SELECT count(*) as count FROM pg_attribute, pg_type WHERE attrelid = typrelid and typname = 'table_name' and attname in ('column1','column2','column3','column4')
我试图以这种方式获取“计数”列的值(当然在执行查询之后):-
$columnExist->getInt('count')
这里的问题是我得到“无效结果集列”:数数'。我不确定这里出了什么问题,任何人都可以帮助我。不过,该查询适用于此:-
$columnExist->next() //returns 4
I have a query which goes like this :-
SELECT count(*) as count FROM pg_attribute, pg_type WHERE attrelid = typrelid and typname = 'table_name' and attname in ('column1','column2','column3','column4')
I'm trying to get the value of the column 'count' this way (after I execute the query of course):-
$columnExist->getInt('count')
The problem here is I'm getting 'Invalid resultset column: count'. I'm not sure what is the problem here, anyone can help me out. The query works with this though :-
$columnExist->next() //returns 4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我设法解决了它。一个愚蠢的错误。应按此顺序执行:-
I managed to solve it. A stupid mistake. Should execute in this order :-