Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Query Question -- Query Using Monthly Data

Re: Query Question -- Query Using Monthly Data

From: Terry Dykstra <tddykstra_at_forestoil.ca>
Date: Tue, 25 Sep 2007 17:14:03 GMT
Message-ID: <vlbKi.78927$Pd4.44322@edtnps82>


"Jerome Vitalis" <vitalismanN05P4M_at_gmail.com.invalid> wrote in message news:46f93913$0$9091$79c14f64_at_nan-newsreader-06.noos.net...
> On Tue, 25 Sep 2007 08:49:40 -0700, Smitty wrote:
>
>> Hello everyone. I currently have a simple table, DAILY, containing
>> various daily transactions. The table has a date column, transaction 1,
>> transaction2, transaction3 etc. Example:
>>
>> DATE Transaction1 Transaction2 Transaction3 1-1-2007
>> 5 3 1 1-13-2007 3
>> 7 9 1-17-2007 6
>> 2 4 2-3-2007 5 3
>> 1 3-10-2007 5 3 1
>>
>> I need to grab the data from the DAILY table, and insert the sum of all
>> transactions for each month into a MONTHLY table, so I will have:
>>
>> DATE Transaction1 Transaction2 Transaction3 2007-01
>> 14 12 14 2007-02 5
>> 3 1 2007-03 5
>> 3 1
>>
>> I am very new to SQL, so I am not sure if this is simple or not. Thanks
>> very much in advance.
>
> Post your try first. And explain exactly how many columns there are in
> your tables.

Take a look at the GROUP BY clause in a SELECT statement. You'll also need to use a TO_CHAR() function with the proper format string to get just a year-month.

-- 
Terry Dykstra 
Received on Tue Sep 25 2007 - 12:14:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US