Prev: Can Oracle Pass-Through SQL execute a Stored Procedure?
Next: Hour and Minute extraction from Time
From: William Shakespeare on 5 Jan 2010 15:29 I have data that looks like this: id cell pur_type buyer 1 1 shoes 1 1 1 other 1 2 1 shoes 1 3 2 shoes 1 4 2 shoes 1 I can write a proc tabluate that uses formats to generate a table like this: Group #Buyers ------------------------------------------ Cell 1 Shoes 2 Cell 1 Other 1 Cell 2 Shoes 2 ------------------------------------------ Total 5 The problem is with the total of 5 buyers. Since id=1 has purchases in two categories it is counted twice. This is fine if I want to compute row percentages, but my bottom line counts are distorted. I'd like something like this: Group #Unique Buyers ------------------------------------------ Cell 1 Shoes 2 Cell 1 Other 1 Cell 2 Shoes 2 ------------------------------------------ Total 4 This way, row percentages would have the correct denominator while the total number of unique buyers would be accurate. Any suggestions on the best way to accomplish this?
|
Pages: 1 Prev: Can Oracle Pass-Through SQL execute a Stored Procedure? Next: Hour and Minute extraction from Time |