Hi there,

I was wondering if anyone could help.

I am using the following data to extract information ( this is just a sample there are many more columns)

BD_SANUMBER DF_LOCATION_KEY
----------- ---------------
1 5
2 8
2 8
2 5
3 8
2 1
2 8

I want query this as

SELECT COUNT (*), BD_SANUMBER, DF_LOCATION_KEY
FROM T.RPTDEFECTS
GROUP BY BD.SANUMBER DF_LOCATION_KEY

Which give me these results

COUNT(*) BD_SANUMBER DF_LOCATION_KEY
-------- ----------- ---------------
1 1 5
1 2 1
1 2 5
3 2 8
1 3 8


However if the BD_SANUMBER and the DF_LOCATION_KEY are the same I want the count to be 1 therefore
there should be two occurrences of DF_LOCATION_KEY 8 each showing a count of 1.

This is needed for reporting purposes

Any help would be great