我正在尝试从shell运行此命令:
sqlite3 salesShare1.db "
select
UsersSale.saleSpecificProduct,
UsersSale.fAtMall,
Users.name,
Users.gender,
Stores.storeName
FROM
UsersSale
INNER JOIN (Users INNER JOIN Stores ON Users.userID = UsersSale.userID) ON
Stores.storeID = UsersSale.saleStoreID
ORDER BY UsersSale.saleID";
错误:没有这样的列:Users.name
我创建了所有表格和列。
sqlite3 salesShare1.db "select * FROM Users ";
1|hezi|0|||
'hezi'是Users.name
我做错了什么?
答案 0 :(得分:2)
请试试
select us.saleSpecificProduct,
us.fAtMall,u.name,
u.gender,st.storeName
from UsersSale us,Users u,Stores st
where u.userID=us.userID and st.storeID=us.saleStoreID
order by us.saleID
或
select us.saleSpecificProduct,
us.fAtMall,u.name,
u.gender,st.storeName
from UsersSale us
inner join Users u
on u.userID=us.userID
inner join Stores st
on st.storeID=us.saleStoreID
order by us.saleID
希望有所帮助
答案 1 :(得分:0)
你的内心联系有点尴尬。
在黑暗中拍摄,但我猜你需要加入用户表:
select
us.saleSpecificProduct,
us.fAtMall,
u.name,
u.gender,
s.storeName
FROM
UsersSale us
INNER JOIN Users u ON u.userID = us.userID
INNER JOIN Stores s ON s.storeID = us.saleStoreID
ORDER BY us.saleID
答案 2 :(得分:0)
在sqlite3工具中显示表格的架构,并确认您的列名称是您认为的那样。也许你错误输入了这个名字。