Avoiding 2 Group By clauses [message #660826] |
Mon, 27 February 2017 09:28 |
|
manikandan23
Messages: 34 Registered: February 2017
|
Member |
|
|
I want the faster method of returning the customers who purchased one and only one product id.
cust_id order_date prod_id units
C1 01-JAN-00 P1 10
C2 01-JAN-02 P2 15
C2 01-FEB-03 P2 16
C3 01-APR-02 P3 17
C4 01-APR-03 P1 20
C4 01-JAN-06 P2 2
C4 05-AUG-07 P5 1
C1 01-MAY-06 P1 7
C1 01-MAY-07 P1 3
C5 01-AUG-07 P4 7
C5 02-AUG-08 P1 5
In the above example, my results should be
C1
C2
C3
|
|
|
|
|
|
|
Re: Avoiding 2 Group By clauses [message #660840 is a reply to message #660826] |
Mon, 27 February 2017 12:00 |
|
Michel Cadot
Messages: 68643 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
Michel Cadot wrote on Mon, 27 February 2017 16:29Michel Cadot wrote on Sun, 26 February 2017 08:37
Welcome to the forum.
Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" or "Preview Quick Reply" button to verify.
With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
|
|
|