Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concat within COUNT function 1

Status
Not open for further replies.

JRO061601

MIS
May 30, 2002
92
US
Is it possible to do a count distinct of a concatenation of two numeric columns in DB2? Something like this...

COUNT(DISTINCT(NUMBER1 CONCAT NUMBER2))

If so, could you provide the syntax?

Thanks.
 
JR0061601,

I accomplished it as follows with a bit of casting to CHAR. My fields were Integers.

SELECT
COUNT(DISTINCT(CHAR(NUMBER1)||CHAR(NUMBER2)))
FROM
YOURDB2TABLE;

Cheers
Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top