I am creating a new table that sums the values from the stock
table for each item_id
and then puts them into the new table. This works fine using this code:
create table total_stock as (
select item_id,
sum (stock) total_stock
from stock_tbl
group by item_id
);
which works fine, adding all the values from the stock
table and putting them into the new table, but when I try to order it by item_id
it doesn't work. Any help would be appreciated. The error given is a syntax error.
create table total_stock as (
select item_id,
sum (stock) total_stock
from stock_tbl
group by item_id
order by item_id
);