![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 : 1st 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 sales.prod = 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') 2nd 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 |
#3
| |||
| |||
|
|
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 : 1st 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 sales.prod = 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') 2nd 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 |
#4
| |||
| |||
|
|
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 : 1st 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 sales.prod = 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') 2nd 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 |
#5
| |||
| |||
|
|
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 : 1st 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 sales.prod = 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') 2nd 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 |
#6
| |||
| |||
|
|
and mod(substr(suppl,7,1),1 ) = 0 |
#7
| |||
| |||
|
|
and mod(substr(suppl,7,1),1 ) = 0 |
#8
| |||
| |||
|
|
and mod(substr(suppl,7,1),1 ) = 0 |
#9
| |||
| |||
|
|
and mod(substr(suppl,7,1),1 ) = 0 |
![]() |
| Thread Tools | |
| Display Modes | |
| |