2014-10-30 54 views
3

我有兩個表,我的外部選擇集合了所有那些存在於我放在where子句中的另一個表中的id。兩張表都使用通配符功能生成。以下是查詢 -分組依據選擇不工作

SELECT count(id), timestamp FROM (TABLE_QUERY(dataset1, 'expr')) 
WHERE id IN (SELECT id FROM (TABLE_QUERY(dataset1, 'expr')) 
WHERE timestamp < 1414670361836) ) group by timestamp 

我獲得以下錯誤 -

Query Failed Error: (L1:56): JOIN (including semi-join) and UNION ALL (comma) may not be combined in a single SELECT statement. Either move the UNION ALL to an inner query or the JOIN to an outer query.

有人能指出我出什麼問題以及如何解決它。

回答

7

重新執行查詢處理公共數據。

這不起作用:

SELECT COUNT(actor), created_at 
FROM (TABLE_QUERY([publicdata:samples], "table_id CONTAINS 'github'")) 
WHERE actor IN (
    SELECT actor 
    FROM (TABLE_QUERY([publicdata:samples], "table_id CONTAINS 'github'")) 
    WHERE created_at > '') 
GROUP BY created_at 

Error: (L2:1): JOIN (including semi-join) and UNION ALL (comma) may not be combined in a single SELECT statement. Either move the UNION ALL to an inner query or the JOIN to an outer query. 

這並不:

SELECT COUNT(actor), created_at 
FROM (
    SELECT actor, created_at 
    FROM (TABLE_QUERY([publicdata:samples], "table_id CONTAINS 'github'")) 
) 
WHERE actor IN (
    SELECT actor 
    FROM (TABLE_QUERY([publicdata:samples], "table_id CONTAINS 'github'")) 
    WHERE created_at > '' 
    LIMIT 100) 
GROUP BY created_at 

我剛搬來的

SELECT actor, created_at 
    FROM (TABLE_QUERY([publicdata:samples], "table_id CONTAINS 'github'")) 

到內層查詢。

+0

謝謝菲利普,它的工作原理。 – pankajmi 2014-10-31 05:38:10