2013-05-04 79 views
0

我有一張表,我們稱之爲Customer和一個基於索引表中文本的FullText表Customer_tSQlite加入結果

Customer 
    ID 
    Name 
    City 

Customer_t 
    ID 
    SearchText (just the Name and City put together) 

使用Full Text indexSQlite MATCH來看,我如何才能匹配Customer_t搜索了所有客戶的列表。基本上是一個連接,但是作爲搜索源的連接表是一個全文索引表。

卡住了。

感謝

回答

1

使用JOIN:

SELECT * 
FROM Customer 
JOIN (SELECT ID 
     FROM Customer_t 
     WHERE SearchText MATCH '...') 
USING (ID) 

或子查詢:

SELECT * 
FROM Customer 
WHERE ID IN (SELECT ID 
      FROM Customer_t 
      WHERE SearchText MATCH '...')