I have a bigQuery table with 30+ columns and I want to SELECT * where session is unique.
I've been to almost all questions regarding this subject in StackOverflow but none helped me to achieve the expect result.
I've tried SELECT COUNT(DISTINCT session) FROM table.id but the problem is that returns only session column and I need the whole row.
Then I tried:
SELECT *
FROM `table.id`
WHERE session IN (
SELECT session
FROM `table.id`
GROUP BY session
HAVING COUNT(*) = 1
)
But it returns much less rows then SELECT COUNT(DISTINCT sessions)
So by logic I tried:
SELECT *, COUNT(DISTINCT sessions) and SELECT * WHERE COUNT(DISTINCT sessions)
none works
Anyone can help? Thanks in advance and kind regards,