Arbwpgienn
New Member
Hi all am trying to build a sql query to display some information on a dashboard.I have a table in which i store my sales data.My query needs to find total sales in last 7 days,average and group it based on region(which is present in user table.) .I created a temp table to get the item sales.DashBoard_Items table contains particular item that needs to be shown on dashboard.Now my problem is i need to get the store count of each region to find average sales.Can some one please help\[code\]Declare @TableTest table(itemid int,itemname varchar(100),itemdescription varchar(100),id int,itemidd int,userid int,orderdate varchar(40),qty int)insert into @TableTest select * from DashBoard_Items join SalesQTY on SalesQTY.OrderDate>= CONVERT(varchar(10) , DATEADD(DAY,-7,GETDATE()),126) and OOS_DashBoard_CoreItems.itemid=SalesQTY.itemidselect distinct t.userid,u.region from @TableTest t join users u on t.userid=u.userid and region is not null\[/code\]above select query returns
how can i get region count from the above select query\[code\] region count 5 - SUN WEST 2 2 - LONG ISLAND 3\[/code\]