What is max doing across fields in a de-duplication ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jack

    What is max doing across fields in a de-duplication ?

    Greetings folks,

    Just curious if anyone knows what the following would produce:
    SELECT
    MAX( ECP_SUPPORT_DED _EMAIL.CD_TYP_C MPGN) CD_TYP_CMPGN,
    MAX(ECP_SUPPORT _DED_EMAIL.CELL _ID) CELL_ID,
    ECP_SUPPORT_DED _EMAIL.CLIC_CUS T_ID CUSTID,
    MAX( ECP_SUPPORT_DED _EMAIL.ADDRESS) CONTACTED_PARTY ID,
    MAX( ECP_SUPPORT_DED _EMAIL.CONTACTE D_PARTY_ID_TYPE )
    FROM
    ECP_SUPPORT_DED _EMAIL
    group by CUSTID

    For a given CUSTID, and assuming all fields are character and there
    are duplicates, will it randomly select the MAX value of any of these
    fields across duplicates, or will it randomly select a custID and
    retain that row's attributes with integrity?

    thanks!
    Jack
  • Jan

    #2
    Re: What is max doing across fields in a de-duplication ?

    I have no idea, but let`s guess - it will return the max values of the
    rows for each custid?

    jack_posemsky@y ahoo.com (Jack) wrote in message news:<209b7e58. 0402080701.31e9 2c77@posting.go ogle.com>...
    Greetings folks,
    >
    Just curious if anyone knows what the following would produce:
    SELECT
    MAX( ECP_SUPPORT_DED _EMAIL.CD_TYP_C MPGN) CD_TYP_CMPGN,
    MAX(ECP_SUPPORT _DED_EMAIL.CELL _ID) CELL_ID,
    ECP_SUPPORT_DED _EMAIL.CLIC_CUS T_ID CUSTID,
    MAX( ECP_SUPPORT_DED _EMAIL.ADDRESS) CONTACTED_PARTY ID,
    MAX( ECP_SUPPORT_DED _EMAIL.CONTACTE D_PARTY_ID_TYPE )
    FROM
    ECP_SUPPORT_DED _EMAIL
    group by CUSTID
    >
    For a given CUSTID, and assuming all fields are character and there
    are duplicates, will it randomly select the MAX value of any of these
    fields across duplicates, or will it randomly select a custID and
    retain that row's attributes with integrity?
    >
    thanks!
    Jack

    Comment

    • Ed prochak

      #3
      Re: What is max doing across fields in a de-duplication ?

      janik@pobox.sk (Jan) wrote in message news:<81511301. 0402100246.11a3 feb4@posting.go ogle.com>...
      I have no idea, but let`s guess - it will return the max values of the
      rows for each custid?
      >
      jack_posemsky@y ahoo.com (Jack) wrote in message news:<209b7e58. 0402080701.31e9 2c77@posting.go ogle.com>...
      Greetings folks,

      Just curious if anyone knows what the following would produce:
      SELECT
      MAX( ECP_SUPPORT_DED _EMAIL.CD_TYP_C MPGN) CD_TYP_CMPGN,
      MAX(ECP_SUPPORT _DED_EMAIL.CELL _ID) CELL_ID,
      ECP_SUPPORT_DED _EMAIL.CLIC_CUS T_ID CUSTID,
      MAX( ECP_SUPPORT_DED _EMAIL.ADDRESS) CONTACTED_PARTY ID,
      MAX( ECP_SUPPORT_DED _EMAIL.CONTACTE D_PARTY_ID_TYPE )
      FROM
      ECP_SUPPORT_DED _EMAIL
      group by CUSTID

      For a given CUSTID, and assuming all fields are character and there
      are duplicates, will it randomly select the MAX value of any of these
      fields across duplicates, or will it randomly select a custID and
      retain that row's attributes with integrity?

      thanks!
      Jack
      First there is nothing RANDOM about it.

      MAX() returns the largest value of the COLUMN.

      so for mytable:
      cmpgn cell custid
      xxxx abc 234
      aaaa xyz 234

      select max(cmpgn), max(cell), custid
      from mytable group by custid ;

      returns
      max(cmpgn) max(cell) custid
      xxxx xyz 234

      hth,
      ed

      Comment

      Working...