Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Amount pr. week

Status
Not open for further replies.

lhg1

IS-IT--Management
Mar 29, 2005
134
DK
Hi

I have a need list a amount pr. week but since the date format is quite tricky I can't get it to work.

This is an sql to get the tickets.
Code:
SELECT ticketid
CONVERT(VARCHAR, DATEADD(ss, TIME_WORK_START - DATEDIFF(ss, GETDATE(), GETUTCDATE()), '1970-01-01 00:00'), 120),
from table

The result of the query should be something like this.
week amount
30 12
31 13
32 14

Thanks.
LHG
 
Check Datepart() function in BOL.
You can pass [wk] as first parameter that will return you the Week Number of the date you passed.
Read carefully the whole article to see what week number you can get when you change SET DATEFIRST.

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top