2018-08-07 17:08:51 +00:00
|
|
|
SELECT UserID, arrayEnumerateUniq(groupArray(SearchPhrase)) AS arr
|
2021-05-15 09:11:13 +00:00
|
|
|
FROM
|
2018-08-07 17:08:51 +00:00
|
|
|
(
|
|
|
|
SELECT UserID, SearchPhrase
|
|
|
|
FROM test.hits
|
2018-12-29 22:11:00 +00:00
|
|
|
WHERE CounterID = 1704509 AND UserID IN
|
2018-08-07 17:08:51 +00:00
|
|
|
(
|
|
|
|
SELECT UserID
|
|
|
|
FROM test.hits
|
2018-12-29 22:11:00 +00:00
|
|
|
WHERE notEmpty(SearchPhrase) AND CounterID = 1704509
|
2018-08-07 17:08:51 +00:00
|
|
|
GROUP BY UserID
|
|
|
|
HAVING count() > 1
|
|
|
|
)
|
|
|
|
ORDER BY UserID, WatchID
|
|
|
|
)
|
|
|
|
WHERE notEmpty(SearchPhrase)
|
|
|
|
GROUP BY UserID
|
|
|
|
HAVING length(arr) > 1
|
|
|
|
ORDER BY UserID
|
|
|
|
LIMIT 20
|