- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: select week and year 1 year in the past
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 08:40 PM
тАО01-27-2005 08:40 PM
Re: select week and year 1 year in the past
Data from the last year:
select max( week), max( year) as max_date
from table
where year in ( select max(year)-1 from table)
The data from the last 3 month, I'm afraid it is not possible because you don't have dates but number... Why do you use numbers to represent dates?? Dates can be transformed in seconds, mintutes, hours, days, weeks, months and years but numbers...
Best Regards,
Eric Antunes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 08:41 PM
тАО01-27-2005 08:41 PM
Re: select week and year 1 year in the past
1. last year :
select sum(xxx), avg(xxx), ...
from table
where (year*100 + week) >
(select max((year-1)*100+week)
from table)
2. last 3 months:
define 3 months
can you live with 13 weeks which is more or less 3 months??
regards,
Thierry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 08:46 PM
тАО01-27-2005 08:46 PM
Re: select week and year 1 year in the past
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 08:59 PM
тАО01-27-2005 08:59 PM
Re: select week and year 1 year in the past
year stat is probably solved by
year*100+week > (select max(year*100+week)-100
3 months can be defined as 12 weeks.
As I see I should update table with 1 additional row where I include some date within the reported week it will make my live much easier.
By the rules thursday means 1 week I am going to put thursday beside every row with week.
3month probably has no reason to create.
If I need quartal sum and avg than it will be more logical to create fixed periods 1Q = week(1..12) 2Q=week(13-25) ......
Reason why there are weeks years as number format is bc this is imported data from excel. last 2 years people included data there and I decided to convert it into database for better/effective manipulation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 09:34 PM
тАО01-27-2005 09:34 PM
Re: select week and year 1 year in the past
try using rownum <4
hope this helps!
regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 09:49 PM
тАО01-27-2005 09:49 PM
Re: select week and year 1 year in the past
So you have weeks from 1 to 52. I understood you had just from 1 to 4.
You see, to get data from Q1 it is much more correct to work with dates than with numbers because, for example, week 14 of 2004 as only 3 days in March (Q1) and has 4 days in April (Q2)...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 09:57 PM
тАО01-27-2005 09:57 PM
Re: select week and year 1 year in the past
I can do it by rownum ;-)
this is the syntax and it works.
select .... from table where year*100+week in (
select rownum,wy from (select distinct year*100+week as wy from table order by 1 desc) where rownum < 12)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 09:59 PM
тАО01-27-2005 09:59 PM
Re: select week and year 1 year in the past
In my country has every week 7 days.
I have never heard of week with less than 7 days except last/firs weeks of year
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 10:06 PM
тАО01-27-2005 10:06 PM
Re: select week and year 1 year in the past
You didn't understand my previous post... I'll try do explain better with 2 questions:
31-03-2004 is from witch week and quarter?
01-04-2004 is from witch week and quarter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2005 10:19 PM
тАО01-27-2005 10:19 PM
Re: select week and year 1 year in the past
31-03-2004 is from witch week and quarter?
is week 14
01-04-2004 is from witch week and quarter?
is week 14
05-04-2004
is week 15