DB2 11.5 on windows
This should be easy but for some reason I just can't wrap my head around it. I have a table that has credit card info. cc_first6, cc_last4, cc_hash
I want to query the table to find records that have the same first6 and last4 with different cc_hash values.
I wrote a query that finds the rows with same hash multiple times but I need the opposite. Here is the query I have.
cc_first6, cc_last4, cc_hash, count(*) TheCount from cc_table where LASTTIME > current_date - 1 month group by CC_FIRST6,cc_last4,cc_hash having count(*) > 1 order by cc_first6,cc_last4
I don't have to have the cc_hash in the select list but I do need a count of different hashes for same first6 and last4.