Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mike13
Posting Yak Master
219 Posts |
Posted - 2013-05-04 : 06:37:59
|
Hi All,I got this SPSELECT @count(dbo.T_Product_Option.PackID),@packid= dbo.T_Product_Option.PackIDFROM dbo.T_Order_Main INNER JOIN dbo.T_Order_Detail ON dbo.T_Order_Main.ORDERID = dbo.T_Order_Detail.OrderID INNER JOIN dbo.T_Product_Option ON dbo.T_Order_Detail.OptionID = dbo.T_Product_Option.idWHERE (dbo.T_Order_Main.ORDERID = @orderid) AND (NOT (dbo.T_Product_Option.id IN (SELECT optionid FROM dbo.T_Product_Free)))GROUP BY dbo.T_Product_Option.PackID This has 3 records with the group by it only returns 1But the count still returns 3How can i get the count after the group by?Thanks a lot |
|
mike13
Posting Yak Master
219 Posts |
Posted - 2013-05-04 : 06:56:44
|
found it @@rowcount duuh ;-) |
|
|
|
|
|