-
Need help with SQL
I have 2 tables one called customer and one called order. I am attempting to create a 3rd table then insert data into the 3rd table using a select command. Here is what I have so far can you help me it won't work?
Create Table Balance
(customer_id number(7), Last char(10),first char(10),total_balance number (2,d);
Insert into Balance
select customer.customer_id,customer.last,customer.first, sum (order.price)
From customer,order
where customer.customer_id = order.customer_id
group by customer.customer_id;
What am I doing wrong here?
-
You could try this,
Create Table Balance
(customer_id number(7), Last char(10),first char(10),total_balance number (2,d);
Insert into Balance
select
customer.customer_id
, customer.last
, customer.first
, sum (order.price)
From customer left join order on order.customer_id = customer.customer_id
group by customer.customer_id, customer.last, customer.first;
-
Thank You
I will give it a try Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|