我正在尝试在我创建的数据库中执行查询,但它一直说该列不存在。这是创建表语句
CREATE TABLE messages
(id integer primary key,
message text,
speaker text,
dateref int,
dateshow text,
foreign key(speaker) references users(username)
);
CREATE TABLE subscribers
(subid integer primary key,
host text,
subscriber text,
int dateref,
foreign key(host) references users(username),
foreign key (subscriber) references users(username)
);
CREATE TABLE users
(username text primary key,
password text);
这是查询
select
*
from
messages, subscribers
where
messages.speaker = subscribers.host and
subscribers.dateref <= messages.dateref and
subscribers.subscriber = lee;
奇怪的是,即使是来自订阅者的查询选择dateref也会导致错误错误:没有这样的列:dateref
答案 0 :(得分:1)
在你的create table中,你有“int dateref”而不是“dateref int”。