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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Weekly Report - I need Help

Author  Topic 

lymni22
Starting Member

3 Posts

Posted - 2006-08-17 : 04:35:19
I want to Create Weekly Report for shipped items in a given month and Year.
Write now I am using Temporary table to display the weekly report.
I want to avoid Temporary table for performance Issue.
I need a query that get a input as Month And Year and give the weekly report .
Report Should be like this...

Check the Year whether it is leap or not
====================
Week || Shipped
====================
1 Week | 23
2 Week | 67
3 Week | 45
4 Week | 66

Is Is Possible to get query Using Group By?
Is there Any direct function to get the first day of the month?
Because If the First Day of the month start with wednesday.
The First week report show only first four days of the week and also check the year for leap year and give corresponding weeks.



Lymni

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-17 : 06:00:35
Look at this function [url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519[/url].

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

lymni22
Starting Member

3 Posts

Posted - 2006-08-17 : 07:35:57
quote:
Originally posted by lymni22

I want to Create Weekly Report for shipped items in a given month and Year.
Write now I am using Temporary table to display the weekly report.
I want to avoid Temporary table for performance Issue.
I need a query that get a input as Month And Year and give the weekly report .
Report Should be like this...

Check the Year whether it is leap or not
====================
Week || Shipped
====================
1 Week | 23
2 Week | 67
3 Week | 45
4 Week | 66

Is Is Possible to get query Using Group By?
Is there Any direct function to get the first day of the month?
Because If the First Day of the month start with wednesday.
The First week report show only first four days of the week and also check the year for leap year and give corresponding weeks.



Lymni


This funtion is Too long....
I want implement this task with minimum effort
Please give me any other useful query
thanks in advance

Lymni
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-17 : 07:47:54
So weeks are always 1 to 5?

If the first day of the wanted month is mon-wed, only thu-sun should be considered as week 1?
Following mon-sun as week 2?
Following mon-sun as week 3?
Following mon-sun as week 4?
Following mon-sun as week 5, until day is last day of month?

And this is true for all months possible?

Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-17 : 07:50:51
quote:
Originally posted by lymni22

This funtion is Too long....
I want implement this task with minimum effort
Please give me any other useful query
That's what I did.
All date-handling you ever wish for is in that function.

You only have to install the function once.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-17 : 07:52:57
quote:
Originally posted by lymni22

Is Is Possible to get query Using Group By?
Is there Any direct function to get the first day of the month?
Because If the First Day of the month start with wednesday.
The First week report show only first four days of the week and also check the year for leap year and give corresponding weeks.
Yes.
Yes.
Is this a homework?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -