Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> any thoughts please?!
CREATE TABLE SQL_TABL (
ORD_DATE Date, PROD_CODE Varchar2(10), CUST_CODE Varchar2(10), QTY Number(2), UNIT_PRICE Number(5,2), SHIP_DATE Date, CARR_CODE Varchar2(12), SHIP_COST Number(5,2), PMT_DATE Date
insert into SQL_TABL values ('08-Jan-05', 'A-50-0013', 'Cu-08-143', 4, 181.79, '09-Jan-05', 'TransCo', 60.27, '15-Jan-05'); insert into SQL_TABL values ('15-Jan-05', 'A-25-0753', 'Cu-08-180', 13, 265.61, '23-Jan-05', 'Expedit', 278.36, '29-Jan-05');insert into SQL_TABL values ('19-Jan-05', 'A-24-0101', 'Cu-08-133', 20, 120.18, '22-Jan-05', 'Expedit', 188.28, '29-Jan-05');
hi every one i have a atable like such and many things to do on it, since i am new to sql and i know how important it is, i want you please to help if you see me posting again and agian dont get bored with me please, i ll be posting my attempts and whoever wants can help me, as a first task i want to "Produce total sales per Product Group,per year"the product group is the middle numbers as '50' for the first one '25for the second, so i thought those must be distinct since they are the key so i made the following:
select to_char(ORD_DATE,'yyyy'),distinct( substr (PROD_CODE,3,2)), ((QTY*UNIT_PRICE)+SHIP_COST) from TABLE,
but this doesnt do the job becoz it wont give me the distinct values
but duplicates and thats what i want
you see my attempt can u help me?
thanks
Received on Sun Dec 02 2007 - 13:57:08 CST
![]() |
![]() |