我是新手,我试着在我的数据库上做到这一点
SELECT id FROM import a INNER JOIN import b ON a.id-1 =b.id AND b.val =0 WHERE a.val=-1
Pb:模糊列名:id
我的桌子:
CREATE TABLE "import" ( "id" INTEGER PRIMARY KEY NOT NULL,"id_analyse" integer,"cross" varchar,"date" datetime,"close" double,"low" double,"high" double,"T" integer DEFAULT (NULL),"B" INTEGER )
我无法理解因为我读过
When more than one table is used (in a JOIN for example) there may be two columns with the same name.
我只使用一张桌子!
有人可以帮助我吗?
斯特凡
解决方法
只需指定要选择的ID,例如
SELECT a.id ....
此外,您的表似乎没有您稍后在查询中使用的val列.