Snowflake: Unsupported subquery for DISTINCT - Column order matters?

前端 未结 2 1431
鱼传尺愫
鱼传尺愫 2021-01-16 00:16

I have two related tables (unnecessary columns not listed):

LOCATION

VENUE_ID - NUMBER(38,0)

VISIT

         


        
2条回答
  •  清酒与你
    2021-01-16 00:37

    The answer is a little cryptic, but what happens is this:

    You are asking for ONE value and you need to guarantee that only ONE value is returned by your subquery. A distinct clause cannot guarantee that. In some databases that will work as long as the data returns one row, but the moment you get two rows then the database will throw an error.

    Snowflake is strict on its subquery analysis. So you need to use a subquery that is guarantee to return always one value, for example select sum(..), select count(..)

提交回复
热议问题