SQL syntax for "week-to-date"

Mar 13, 2008 2 Replies

I need to find out total qty sold "week to date" on a SQL query, something like



select i.itemlookupcode, sum(quantity) from transactionentry te inner join [transaction] t on te.transactionnumber = t.transactionnumber inner join item i on te.itemid = i.id where t.time > (week to date) group by i.itemlookupcode


- - week to date being the first day of the current week - sunday



I appreciate any help I can get on this - thanks


Replace this row: where t.time > (week to date) to

where time >= DATEADD(ww,DATEDIFF(ww,0,GETDATE()),0)

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required