SQLTeam.com | Weblogs | Forums

Reterving wk data


Hi all,

I want to retrieve all sales data for a particular fiscal wk. e.g wk 1 ; I have a calendar table (tbl_calander) like one in the image.

How to join this table with sales table(tbl_sales.date). If I join using date column, it is returning duplicate rows as there are many sales in one single day.


Any help would be greatly appreciated.




Please post create table(s) DDL with sample data in the form of inserts. If you take [Date] and use it as start timestamp and join to your sales data tables where transaction time between [Date] and DateAddd(dd, 1, [Date]) and group by [Date]. you might figure the rest out.