469,326 Members | 1,359 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

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_CMPGN) CD_TYP_CMPGN,
MAX(ECP_SUPPORT_DED_EMAIL.CELL_ID) CELL_ID,
ECP_SUPPORT_DED_EMAIL.CLIC_CUST_ID CUSTID,
MAX( ECP_SUPPORT_DED_EMAIL.ADDRESS) CONTACTED_PARTYID,
MAX( ECP_SUPPORT_DED_EMAIL.CONTACTED_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
Jul 19 '05 #1
2 2187
Jan
I have no idea, but let`s guess - it will return the max values of the
rows for each custid?

ja***********@yahoo.com (Jack) wrote in message news:<20**************************@posting.google. com>...
Greetings folks,

Just curious if anyone knows what the following would produce:
SELECT
MAX( ECP_SUPPORT_DED_EMAIL.CD_TYP_CMPGN) CD_TYP_CMPGN,
MAX(ECP_SUPPORT_DED_EMAIL.CELL_ID) CELL_ID,
ECP_SUPPORT_DED_EMAIL.CLIC_CUST_ID CUSTID,
MAX( ECP_SUPPORT_DED_EMAIL.ADDRESS) CONTACTED_PARTYID,
MAX( ECP_SUPPORT_DED_EMAIL.CONTACTED_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

Jul 19 '05 #2
ja***@pobox.sk (Jan) wrote in message news:<81**************************@posting.google. com>...
I have no idea, but let`s guess - it will return the max values of the
rows for each custid?

ja***********@yahoo.com (Jack) wrote in message news:<20**************************@posting.google. com>...
Greetings folks,

Just curious if anyone knows what the following would produce:
SELECT
MAX( ECP_SUPPORT_DED_EMAIL.CD_TYP_CMPGN) CD_TYP_CMPGN,
MAX(ECP_SUPPORT_DED_EMAIL.CELL_ID) CELL_ID,
ECP_SUPPORT_DED_EMAIL.CLIC_CUST_ID CUSTID,
MAX( ECP_SUPPORT_DED_EMAIL.ADDRESS) CONTACTED_PARTYID,
MAX( ECP_SUPPORT_DED_EMAIL.CONTACTED_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
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

56 posts views Thread by Xah Lee | last post: by
145 posts views Thread by Mark Johnson | last post: by
3 posts views Thread by Skyhorse | last post: by
5 posts views Thread by Corrine | last post: by
5 posts views Thread by John | last post: by
2 posts views Thread by Earl Teigrob | last post: by
4 posts views Thread by Raja Chandrasekaran | last post: by
9 posts views Thread by Cao Yi | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.