VIEWS

"Juan Rodriguez" <[email protected]>
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-777653-2002.11.25-05.22.12--gcdod-oracle#[email protected]>
Hi, I'm trying to create a view.  I started with the select statement and 
it works well except for when I try to add the function (sum
(soi.quantity*unit_price)

here is my code... can anyone tell me what I am doing wrong.

Thanks a million...

select soi.id as order#, to_char(order_date,'mm/dd/yyyy')as Order_Date,
region, rtrim(employee.emp_fname)||' '||rtrim(employee.emp_lname) as 
Sales_Rep,
sales_rep as Rep_ID, company_name,rtrim(fname)||' '||rtrim(lname) as 
customer,
'('||substr(customer.phone,1,3)||')'||substr(customer.phone,4,3)||'-
'||substr(customer.phone,7) as phone,
	sum(soi.quantity*unit_price) value
from sales_order_items as soi, sales_order, employee, customer, product
where prod_id=product.id and
soi.id=sales_order.id and 
cust_id=customer.id and
sales_rep=emp_id
group by soi.id, company_name
order by soi.id
/

Juan
---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.