SQLTeam.com | Weblogs | Forums

Reterving wk data


#1

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.

image

Any help would be greatly appreciated.

Thanks

Regards,
SGS


#2

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.