How does mysql define DISTINCT() in reference documentation

后端 未结 2 1493
太阳男子
太阳男子 2020-12-21 11:58

EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying keywords and functions. /EDIT

AFAIK SQL defines two uses of DISTINCT k

2条回答
  •  离开以前
    2020-12-21 12:50

    Interesting scenario.

    As you found,

    SELECT DISTINCT(a), b, c
    

    is equivalent to:

    SELECT DISTINCT (a), b, c
    

    is equivalent to:

    SELECT DISTINCT a, b, c
    

    i.e. the parentheses are treated as expression grouping parentheses.

    Interestingly, a very similar issue occurs in VB6/VBScript where (for Function(byref x)) Function(x), Function x and Call Function(x) are all slightly different in which value they pass by reference (Function(x) passes a reference to the result of the (x) expression and not x).

提交回复
热议问题