sqlite老是报错no such column

windsha 2009-10-22 02:00:33
SELECT qsmallClass.Sname, qproducts.pmodel, qproducts.punit, qmaintain.mcount FROM qsmallClass INNER JOIN (qproducts INNER JOIN qmaintain ON qproducts.pid = qmaintain.pid) ON qsmallClass.Sid = qproducts.Sid

报错 no such column: qproducts.pmodel

请问这是怎么回事,要如何解决?
...全文
5642 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
nietsche 2009-11-23
  • 打赏
  • 举报
回复
不好意思,是select语句错误,应该用',',而不是空格。
nietsche 2009-11-23
  • 打赏
  • 举报
回复
同样问题:
cur.execute('select genre from contactors')
<sqlite3.Cursor object at 0x01D46860>
---没有问题
可是:
cur.execute('select genre name cellphone from contactors')
Traceback (most recent call last):
File "<input>", line 1, in <module>
OperationalError: no such column: genre
--不知为何,有这一列,为何多列查询时,就出错,就没有这列了呢?
windsha 2009-10-22
  • 打赏
  • 举报
回复
这三个表的结构如下:

create table qmaintain(mid integer primary key,mvid,pid,mcount);
create table qsmallclass(sid integer primary key,sname,bid);
create table qproducts(pid integer primary key,sid,pmodel,pbrand,punit,pmoney,pcount,pmaintains,preturns,pdesc);
windsha 2009-10-22
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 acmain_chm 的回复:]
qproducts.表中有这一列pmodel吗?

.schema qproducts

看一下你的表结构。
[/Quote]

这一列肯定存在
WWWWA 2009-10-22
  • 打赏
  • 举报
回复
qproducts.pmodel:列存在吗
ACMAIN_CHM 2009-10-22
  • 打赏
  • 举报
回复
qproducts.表中有这一列pmodel吗?

.schema qproducts

看一下你的表结构。
windsha 2009-10-22
  • 打赏
  • 举报
回复
多谢楼上,问题解决
WWWWA 2009-10-22
  • 打赏
  • 举报
回复
SELECT a.Sname, b.pmodel, b.punit, c.mcount FROM qsmallClass a
INNER JOIN qproducts b ON a.Sid = b.Sid
INNER JOIN qmaintain c ON b.pid = c.pid
去掉()

2,209

社区成员

发帖
与我相关
我的任务
社区描述
其他数据库开发 其他数据库
社区管理员
  • 其他数据库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧