Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Dell PowerEdge Servers
  #1  
Old September 14th, 2004, 12:58 AM
Sasi242 Sasi242 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 9 Sasi242 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 22 sec
Reputation Power: 0
"Zero Sales products"

Hi All
I Need Some Help In Writing A Query In SQL.

I Have The Below Tables

SQL> desc sales_invoice;
Name Null? Type
----------------------------------------------------------------------------------- -------- ------
INVOICE_NO NUMBER(3)
INVOICE_DATE DATE
PRODUCT_CODE VARCHAR2(2)
QUANTITY NUMBER(6,3)
RATE NUMBER(6,2)
VALUE NUMBER(10,2)
SALES_TAX_TYPE VARCHAR2(6)
SALES_TAX_AMOUNT NUMBER(10,2)
TOTAL_VALUE NUMBER(10,2)
PLACE VARCHAR2(2)

SQL> select * from sales_invoice;

INVOICE_NO INVOICE_D PR QUANTITY RATE VALUE SALES_ SALES_TAX_AMOUNT TOTAL_VALUE PL
---------- --------- -- ---------- ---------- ---------- ------ ---------------- ----------- --
1 02-JUL-04 01 3 15 45 APGST 3.6 48.6 01
2 02-JUL-04 03 1 23 23 CST 2.76 25.76 03
3 03-JUL-04 03 2 21 42 42 02
4 04-JUL-04 02 4 19 76 APGSTG 3.04 79.04 02
5 05-JUL-04 05 5 11 55 CSTC 2.2 57.2 04
6 02-AUG-04 04 1 65 65 APGST 5.2 70.2 01
7 07-AUG-04 03 3 14 42 42 03
5 10-AUG-04 05 -3 11 -33 CSTC -1.32 -34.32 04
8 11-AUG-04 02 4 12 48 CST 5.76 53.76 03
9 19-AUG-04 02 3 17 51 APGSTG 2.04 53.04 02
10 05-SEP-04 01 5 15 75 CST 9 84 03
10 06-SEP-04 01 -5 15 -75 CST -9 -84 03
11 07-SEP-04 03 3 25 75 CST 9 84 04
12 15-SEP-04 05 5 15 75 APGST 4 54 02
13 20-SEP-04 03 3 20 60 APGSTG 2.4 62.4 01

15 rows selected.

SQL> desc product;
Name Null? Type
----------------------------------------------------------------------------------- -------- ------
PRODUCT_CODE VARCHAR2(2)
PRODUCT_NAME VARCHAR2(20)
LIST_PRICE NUMBER(6,2)
COST NUMBER(6,2)
UNIT VARCHAR2(3)

SQL> select * from product;

PR PRODUCT_NAME LIST_PRICE COST UNI
-- -------------------- ---------- ---------- ---
01 TOOTH PASTE 15 14 NO
02 SOAP 20 15 NO
03 SHAMPOO 25 22 NO
04 SUNFLOWER OIL 65 45 KG
05 MINERAL WATER 12 10 LT

SQL> desc place;
Name Null? Type
----------------------------------------------------------------------------------- -------- ------
PLACE VARCHAR2(2)
PLACE_NAME VARCHAR2(20)

SQL> select * from place;

PL PLACE_NAME
-- --------------------
01 HYDERABAD
02 SECUNDERABAD
03 BANGLORE
04 CHENNAI

Here I Want To Find Out "Place wise,Productname wise-'zero sales products.
Thanks In Advance
Sasi

Reply With Quote
  #2  
Old September 14th, 2004, 09:45 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
If I understand your question correctly then following query might be help you, but 100% satisfaction not guranteed, you can make certain changes to fullfil your requirement.

SELECT p.place_name, r.product_name, r.list_price, r.cost
FROM place p, product r
WHERE NOT EXISTS (SELECT 1 FROM sales_invoice s
WHERE .product_name = s.product_name
AND s.place = p.place)
/

Reply With Quote
  #3  
Old September 14th, 2004, 09:45 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
If I understand your question correctly then following query might be help you, but 100% satisfaction not guranteed, you can make certain changes to fullfil your requirement.

SELECT p.place_name, r.product_name, r.list_price, r.cost
FROM place p, product r
WHERE NOT EXISTS (SELECT 1 FROM sales_invoice s
WHERE .product_name = s.product_name
AND s.place = p.place)
ORDER BY 1, 2
/

Reply With Quote
  #4  
Old September 14th, 2004, 09:45 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
If I understand your question correctly then following query might be help you, but 100% satisfaction not guranteed, you can make certain changes to fullfil your requirement.

SELECT p.place_name, r.product_name, r.list_price, r.cost
FROM place p, product r
WHERE NOT EXISTS (SELECT 1 FROM sales_invoice s
WHERE .product_name = s.product_name
AND s.place = p.place)
ORDER BY 1, 2
/

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > "Zero Sales products"


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway