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 |
ilimax
Posting Yak Master
164 Posts |
Posted - 2006-08-28 : 17:08:20
|
I am trying to make procedure where I will pull sales in last 30 days for one item....this does not work ...CREATE PROCEDURE LastThirthySales@ItemNumco nvarchar(30),@Quantity float OUTPUTASSET NOCOUNT ONDECLARE @ItemN nvarchar(30)SET @ItemN = @ItemNumcoSELECT @Quantity=SUM(Quantity) AS SumQtyFROM arhPOSInvoiceItemsWHERE [Item Number] = @ItemN AND ([Ship Date] BETWEEN GETDATE() - 30 AND GETDATE())GROUP BY [Item Number]GO |
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-08-28 : 17:50:37
|
When you say it doesn't work - what is the problem? You mustn't group by [Item Number] because you are limiting the results to a single item in the WHERE clause. |
 |
|
|
|
|