Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
IKU
Starting Member
11 Posts |
Posted - 2009-03-25 : 05:28:14
|
I have to make a sql statment which compares two days with the same weekday in different years. It would have to look like this:Amount on the 5-th January 2009 (first monday of the year 2009) compared to 7-th January 2008 (first monday of the year 2008), and so on (2009-01-12 - 2nd monday 2009 vs. 2009-01-14 - 2nd monday 2008).Day of this year would have to be a parameter in query, and day of last year should be taken automatically. I hope there is someone to help me. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-03-25 : 06:00:30
|
Do you have some sample data and expected output? E 12°55'05.63"N 56°04'39.26" |
|
|
IKU
Starting Member
11 Posts |
Posted - 2009-03-25 : 07:15:30
|
Yes, sorry, I forgot to post itHere it is......Sales headers table consists of four columns Shop, date, quantity and value of merchandiseI need to compare value of merchandise and quantity between two dates which are in the same table.For example results i expect to get would be:Sold quantity on 2009-01-05 (Monday) = 550 pcsSold quantity on 2008-01-07 (Monday) = 400 pcs------------------------------------------------Sales incresement on 2009-01-05 (Monday) = 150 pcs |
|
|
|
|
|