xiangfu0 commented on issue #11002: URL: https://github.com/apache/pinot/issues/11002#issuecomment-1615274498
I think the valid query should be ```WITH fd AS ( SELECT user_id, affiliate FROM ( SELECT user_id, affiliate, row_number() OVER (PARTITION BY user_id ORDER BY count(0) DESC) AS rn FROM sensitive_table GROUP BY user_id, affiliate ) ac WHERE rn = 1 ) SELECT fd.user_id, s2.account_user_id, fd.affiliate FROM sensitive_table_2 s2 RIGHT JOIN fd ON fd.user_id = s2.account_user_id WHERE fd.user_id = 'sensitive_user_id' ``` For RIGHT JOIN, you don't need `fd.user_id = 'sensitive_user_id' OR s2.account_user_id = 'sensitive_user_id'` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org