Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL calcul
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
![]() |
![]() |