473,388 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

If we give this year and weekid like 201106 we have to find last week data?

Hi,
if the we give the data retrieval given in yyyyww from in which yyyy= year and ww=week ex:201206
i have to retrive the last week monday(frist_day) sales data and last sunday(last_day) data ex:201205.

when we give the same any week in the year , we have to retrive last week monday(frist_day) and sunday(last_day)
we have to find.

pls send the logic.

Thanks in Advance.
RK
Feb 8 '12 #1
3 2409
Rabbit
12,516 Expert Mod 8TB
The logic is simple, calculate the week number of the sale by taking the dayofyear and integer dividing by 7 and adding 1 (I'm assuming you have a sale date field that is a date time data type). Then you append that to the year. Finally, you compare it to your parameter.
Feb 8 '12 #2
can you write that query .
im not understanding that, im new for db2.

i have a columns like sales_day and week id-yyyyww(201206),and weekday
Feb 8 '12 #3
Rabbit
12,516 Expert Mod 8TB
Sorry, I don't give code out unless the poster shows they've attempted to solve the problem.
Feb 8 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: SimonC | last post by:
I would like to return data from the last 2 weeks of each given month in Javascript, but in 2 formats. So, the penultimate week (Monday to Sunday) and the last week (Monday to ??) I'm not...
1
by: Hadi | last post by:
Hello, I have to DateTime structure, how do I calculate if date A is on the same week with date B or last week of date B? Thanks, Hadi
1
by: Hajime Kusakabe | last post by:
I made a datagrid and it contains several columns. The number of columns depend on what users select from a dropdown list. Therefore the number of columns changes. I would like to find the last...
10
by: sherifffruitfly | last post by:
Hi all, This is how I'm currently getting Friday of last week. It strikes me as cumbersome. Is there a slicker/more elegant way? Thanks for any ideas, cdj
1
by: mcasaurabhsumit | last post by:
Hi friend, I am unable to get last record in sql server 2000. How to find last record in sql server 2000?
1
by: Simon | last post by:
Dear reader, Is there a function or VBA code available to find the week number out of a date field. You can find the year with Year(date field) but now I need the week number out of a...
1
by: guyborn | last post by:
I have been trying to get data from the database from the of the previous month to the second last week of the current month.I only managed to get data from the previous month to today's date. ...
4
by: jtgarrison | last post by:
I apologize in advance if this has been asked for or if I'm missing somithing obvious, but I have a form that I want to auto populate the week beginning and week ending date based on the current...
1
by: Blaikie | last post by:
Hello, I have a basic database to record all customer orders for the Skip Hire company I work for. At the moment I use the 'Find and Replace' function to search through the database so when I need...
1
by: Robin Sakoda | last post by:
Given a year how can i find mounths with 5 sundays in it? Example input:2011 output:jan n feb
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.