Grouping by choice doesn't work

I have two tables, my outer selection concatenates all those ids that are present in my other table that I nested in the where clause. Both tables are generated using the wild cards function. next request -

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

      

I am getting the following error -

Error with query: (L1: 56): JOIN (including semi-join) and UNION ALL (comma) cannot be combined into one SELECT statement. Either go UNION ALL for an inner query or JOIN for an outer query.

Can someone point me to what the problem is and how I can resolve it.

+3


source to share


1 answer


A replay phrase with a public data query.

This does not work:

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.

      

This does:



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

      

I just moved

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

      

for an internal request.

+7


source







All Articles