Home » SQL & PL/SQL » SQL & PL/SQL » Query help (Oracle 11g Unix)
Query help [message #607893] Thu, 13 February 2014 04:27 Go to next message
nagaraju.ch
Messages: 103
Registered: July 2007
Location: bangalore
Senior Member
Hi

I want to write a query to fetch Number of Customers who made purchases and who didn't per each Product.

Output Data should be as below

Product No.Of Customer purchased   No. Of Customers didn't Purchase
Prod        10                           20
Prod1        30                         10

I have Product, Purchase(Fact table) and Customer tables.

Re: Query help [message #607894 is a reply to message #607893] Thu, 13 February 2014 04:33 Go to previous messageGo to next message
John Watson
Messages: 8929
Registered: January 2010
Location: Global Village
Senior Member
Without knowing the structure of your tables and having some data, it is impossible to assist. Therefore, please provide the CREATE TABLE statements and some INSERT statements, and of course examples of the SELECTs that you have tried so far.
Re: Query help [message #607905 is a reply to message #607894] Thu, 13 February 2014 06:16 Go to previous messageGo to next message
nagaraju.ch
Messages: 103
Registered: July 2007
Location: bangalore
Senior Member
Thanks for your reply John,

I don't want exact query, i just need high level idea.

What i thought was Get all customers who purchased, Second query would be to get customer didn't purchase. use Full Outer Join
Re: Query help [message #607907 is a reply to message #607905] Thu, 13 February 2014 06:58 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
surely you just need total number of customers plus number of customers who bought a particular product, then it's simple subtraction to get the other figure.
Previous Topic: Prevent Table Owner from Deleting Records of a Table
Next Topic: Single quote issue in oracle
Goto Forum:
  


Current Time: Fri Apr 19 12:00:44 CDT 2024