sqLite:由于性能原因,在不使用明显区别的情况下加入唯一的子选择

时间:2018-11-16 10:19:35

标签: sqlite

我有两个关节,但我不想再排同一行。
可与选择不同一起使用。
但是出于性能原因,我想在where子句中使用以下内容进行检查:
和x.ROWID!= w.ROWID

但出现以下错误:
[SQLITE_ERROR] SQL错误或缺少数据库(无此类列:w.ROWID

有可能吗?

此处是完整的选择:

select distinct substr(w.wordindexed, 1, 55), substr(w.word, 1, 15), w.wordreplacement
from Words w
       JOIN (SELECT x.ActionListId, x.wordindexed, x.word, x.wordreplacement
             from Words x
             where x.word like "%Hallo %"
               and x.ROWID != w.ROWID
             limit 1)
       JOIN (SELECT p.ActionListId, p.wordindexed, p.word, p.wordreplacement
             from Words p
             where p.word like "%Tool%"
               and p.ROWID != x.ROWID
             limit 1
            )
limit 5;

示例结果:

3   HALLO VON _GLOBALACTIONLISTS\_GLOBAL.AHK    Hallo von _globalActionLists\_global.ahk    ""
6   HALLO WELT  Hallo Welt  ""
9   HALLO VON _GLOBALACTIONLISTS\_GLOBAL.AHK    Hallo von _globalActionLists\_global.ahk    ""

示例示例:

INSERT INTO Words (ActionListID, wordindexed, word, lineNr, count, worddescription, wordreplacement) VALUES (3, 'HALLO VON _GLOBALACTIONLISTS\_GLOBAL.AHK', 'Hallo von _globalActionLists\_global.ahk', 5, null, null, '');
INSERT INTO Words (ActionListID, wordindexed, word, lineNr, count, worddescription, wordreplacement) VALUES (3, 'STOP CHANGEING LIST|RR||AHK|G_CONFIG["LIST"]["CHANGE"]["STOPREXEXTITLE"]:="."', 'stop changeing list|rr||ahk|g_config["list"]["change"]["stopRexExTitle"]:="."', 7, null, null, '');
INSERT INTO Words (ActionListID, wordindexed, word, lineNr, count, worddescription, wordreplacement) VALUES (3, ' DONT CHANGEING LIST|RR||AHK|
', ' dont changeing list|rr||ahk|
', 9, null, null, '');
INSERT INTO Words (ActionListID, wordindexed, word, lineNr, count, worddescription, wordreplacement) VALUES (6, 'HALLO WELT ', 'Hallo Welt ', 9, null, null, '');
INSERT INTO Words (ActionListID, wordindexed, word, lineNr, count, worddescription, wordreplacement) VALUES (9, 'HALLO VON _GLOBALACTIONLISTS\_GLOBAL.AHK', 'Hallo von _globalActionLists\_global.ahk', 5, null, null, '');

标签:

create table Words
(
    ActionListID INTEGER not null,
    wordindexed TEXT not null,
    word TEXT not null,
    lineNr INTEGER,
    count INTEGER,
    worddescription TEXT,
    wordreplacement TEXT not null,
    primary key (ActionListID, word, wordreplacement)
)
;

create index WordIndex
    on Words (ActionListID, wordindexed)
;

0 个答案:

没有答案