The question Need Query for th problem in oracle was identified as duplicate of Need query for the below problem. If one reads the title one can be almost sure it must be the same query but I am not sure if one should see it as duplicates because the first query is a little bit more complex and generally it returns more than one row. But even more strange is that the second question is marked as duplicate of a third question How do I create a user-defined aggregate function?. The second question is tagged "oracle" the third one is tagged "mysql". The second question asks for a select statement the third query asks how to implement a "user defined aggregate function". That does not really make sense to say a question is a duplicate because one possible (poor) answer is the answer of a completely different question.