joining 2 queries

From: Totti <>
Date: Thu, 24 Jan 2008 16:38:47 -0800 (PST)
Message-ID: <>

hi all
i want to show all the sales from tha data i have, that meet the following criteria:

  • Product category is A or C and VAT is 12%
  • The supplier serial number (the last part after the ".") is odd.
  • The customer is from North or West
  • Customer description contains two "K"
  • The total sales value is more than 400.
  • The sale took place on a Monday, Tuesday or Wednesday.

so i did it using 2 quiries as follows :


select to_char(sale_date,'Month DD, YYYY')
"Date",to_char(sale_date,'Dy') "Day",
customer.code, qty, prod, sale_price

from customer,sales, product
where = product.code
and customer.code = sales.customer
and ((substr(prod,1,1)='A' or substr(prod,1,1)='C')and substr(prod, 3,1)=0)
and mod(substr(suppl,7,1),1 ) = 0
and customer.descr like '%K%K%'
and (substr(customer.code,1,1)='A' or substr(customer.code,1,1)='B') and (to_char(sale_date,'Dy')='Mon' or to_char(sale_date,'Dy')='Tue' or to_char(sale_date,'Dy')='Wed')

select to_char(sale_date,'Month DD, YYYY') "Date", sum (qty*sale_price) as "Total"
from sales
group by sale_date
having sum (qty*sale_price)>400

now i need to join these two together, would domebody please give any clue ?
thanks in advance
Best regards Received on Thu Jan 24 2008 - 18:38:47 CST

Original text of this message