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: SQL calcul

Re: SQL calcul

From: TurkBear <jgreco1_at_mn.rr.com>
Date: Tue, 21 May 2002 09:09:18 -0500
Message-ID: <6vkkeuoamoiv02mk1r80tt90p7qejbsp0a@4ax.com>

Try

select ( to_number(to_char(date_broken,'YYYY')) - to_number(to_char(date_by,'YYYY')) ) LifeTime,object_category,count(object_code) group by to_number(to_char(date_broken,'YYYY')) - to_number(to_char(date_by,'YYYY')) ;

( Not real sure about the group by phrase needing enclosing ()s or not...)

"gil guerillot" <gil.guerillot_at_ratp.fr> wrote:

>i' ve already ask for this question but i was probably not very clear
>
>i have one table
>
>object_code
>object_category
>date_buy
>date_broken
>
>
>i want to know for every year and by object_category the number of object in
>life (year between date_buy and date_broken)
>
>like this
>year
> category
> count(object_code)
>
>
>and also when no object of a category is buy or broken in a year
>
>
>
>
>
>

-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------

   http://www.newsfeed.com The #1 Newsgroup Service in the World! -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =----- Received on Tue May 21 2002 - 09:09:18 CDT

Original text of this message

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