Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Anyone help having command
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

Hong Kong
165 Posts

Posted - 08/22/2014 :  06:20:35  Show Profile  Reply with Quote
I am writing this query but cannot show the grand total in last column ? May be i am wrong using the having command , Anyone can help edit this query and Thanks

isnull(xsodetail.memono,'') as memo,
CONVERT(varchar(13), xsodetail.createdatetime, 121) + ':00' as reportdate,
isnull(fl_one_piece_mask_master.who_in_charge,'') as who,
isnull(fl_one_piece_mask_master.description,'') as description,
isnull(xsodetail.sku,'') as sku,

case when xsodetail.shopcode is null
then ' Total'
'Shop '+xsodetail.shopcode end as shop,
sum(xsodetail.salesqty) as qty,
Sum(xsodetail.actualsalesamt) AS SalesAmount

FROM xsodetail
inner join fl_one_piece_mask_master on fl_one_piece_mask_master.sku= xsodetail.sku

WHERE xsodetail.txdate = Convert(varchar, GETDATE(),112)-3 and xsodetail.actualsalesamt>0
GROUP BY CONVERT(varchar(13), xsodetail.createdatetime, 121),
having sum(xsodetail.actualsalesamt)>0

Flowing Fount of Yak Knowledge

2780 Posts

Posted - 08/22/2014 :  08:25:56  Show Profile  Reply with Quote
Please post some sample output from your query
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000