Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Hi,
I have 2 columns they are date, week to date, i want one year data like below format.

Date Name WeekToDate
2008-01-01 00:00:00.000 2008-01-01 00:00:00.000
2008-01-02 00:00:00.000 2008-01-01 00:00:00.000
2008-01-02 00:00:00.000 2008-01-02 00:00:00.000
2008-01-03 00:00:00.000 2008-01-01 00:00:00.000
2008-01-03 00:00:00.000 2008-01-02 00:00:00.000
2008-01-03 00:00:00.000 2008-01-03 00:00:00.000
2008-01-04 00:00:00.000 2008-01-01 00:00:00.000
2008-01-04 00:00:00.000 2008-01-02 00:00:00.000
2008-01-04 00:00:00.000 2008-01-03 00:00:00.000
2008-01-04 00:00:00.000 2008-01-04 00:00:00.000
2008-01-05 00:00:00.000 2008-01-01 00:00:00.000
2008-01-05 00:00:00.000 2008-01-02 00:00:00.000
2008-01-05 00:00:00.000 2008-01-03 00:00:00.000
2008-01-05 00:00:00.000 2008-01-04 00:00:00.000
2008-01-05 00:00:00.000 2008-01-05 00:00:00.000
2008-01-06 00:00:00.000 2008-01-01 00:00:00.000
2008-01-06 00:00:00.000 2008-01-02 00:00:00.000
2008-01-06 00:00:00.000 2008-01-03 00:00:00.000
2008-01-06 00:00:00.000 2008-01-04 00:00:00.000
2008-01-06 00:00:00.000 2008-01-05 00:00:00.000
2008-01-06 00:00:00.000 2008-01-06 00:00:00.000
2008-01-07 00:00:00.000 2008-01-07 00:00:00.000
2008-01-08 00:00:00.000 2008-01-07 00:00:00.000
2008-01-08 00:00:00.000 2008-01-08 00:00:00.000
2008-01-09 00:00:00.000 2008-01-07 00:00:00.000
2008-01-09 00:00:00.000 2008-01-08 00:00:00.000
2008-01-09 00:00:00.000 2008-01-09 00:00:00.000
2008-01-10 00:00:00.000 2008-01-07 00:00:00.000
2008-01-10 00:00:00.000 2008-01-08 00:00:00.000
2008-01-10 00:00:00.000 2008-01-09 00:00:00.000
2008-01-10 00:00:00.000 2008-01-10 00:00:00.000
2008-01-11 00:00:00.000 2008-01-07 00:00:00.000
2008-01-11 00:00:00.000 2008-01-08 00:00:00.000
2008-01-11 00:00:00.000 2008-01-09 00:00:00.000
2008-01-11 00:00:00.000 2008-01-10 00:00:00.000
2008-01-11 00:00:00.000 2008-01-11 00:00:00.000
2008-01-12 00:00:00.000 2008-01-07 00:00:00.000
2008-01-12 00:00:00.000 2008-01-08 00:00:00.000
2008-01-12 00:00:00.000 2008-01-09 00:00:00.000
2008-01-12 00:00:00.000 2008-01-10 00:00:00.000
2008-01-12 00:00:00.000 2008-01-11 00:00:00.000
2008-01-12 00:00:00.000 2008-01-12 00:00:00.000
2008-01-13 00:00:00.000 2008-01-07 00:00:00.000
2008-01-13 00:00:00.000 2008-01-08 00:00:00.000
2008-01-13 00:00:00.000 2008-01-09 00:00:00.000
2008-01-13 00:00:00.000 2008-01-10 00:00:00.000
2008-01-13 00:00:00.000 2008-01-11 00:00:00.000
2008-01-13 00:00:00.000 2008-01-12 00:00:00.000
2008-01-13 00:00:00.000 2008-01-13 00:00:00.000
2008-01-14 00:00:00.000 2008-01-14 00:00:00.000
.
.
.
.
.
.
.
.
.
2008-01-27 00:00:00.000 2008-01-24 00:00:00.000
2008-01-27 00:00:00.000 2008-01-25 00:00:00.000
2008-01-27 00:00:00.000 2008-01-26 00:00:00.000
2008-01-27 00:00:00.000 2008-01-27 00:00:00.000
2008-01-28 00:00:00.000 2008-01-28 00:00:00.000
2008-01-29 00:00:00.000 2008-01-28 00:00:00.000
2008-01-29 00:00:00.000 2008-01-29 00:00:00.000
2008-01-30 00:00:00.000 2008-01-28 00:00:00.000
2008-01-30 00:00:00.000 2008-01-29 00:00:00.000
2008-01-30 00:00:00.000 2008-01-30 00:00:00.000
2008-01-31 00:00:00.000 2008-01-28 00:00:00.000
2008-01-31 00:00:00.000 2008-01-29 00:00:00.000
2008-01-31 00:00:00.000 2008-01-30 00:00:00.000
2008-01-31 00:00:00.000 2008-01-31 00:00:00.000
Thanks
Posted
Updated 15-Aug-13 21:42pm
v3
Comments
Corporal Agarn 14-Aug-13 10:13am    
What have you tried so far?
ridoy 14-Aug-13 16:14pm    
that doesn't make any sense!
RedDk 14-Aug-13 16:26pm    
Looking at this data I can see only a pattern. But "one year" is a requirement that is unintelligible. Please elaborate.
ZurdoDev 14-Aug-13 17:10pm    
So, where are you stuck?
sampath1750 16-Aug-13 3:44am    
I want the display data like below, now i am giving the numbers.
1 1
2 1
2 2
3 1
3 2
3 3
4 1
4 2
4 3
4 4
5 1
5 2
5 4
.
.
.
.
7 6
7 7
after 7 then
8 8
9 8
9 9
10 8
.
.
.
.
i want upto 100

1 solution

You can use YEAR function and/or use BETWEEN operator eg:
SQL
select * from TableName where YEAR(WeekToDate) = 2008
 
Share this answer
 
v2
Comments
Maciej Los 16-Aug-13 3:26am    
It could work.
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900