Viewing 3 posts - 1 through 4 (of 4 total)
Oh I neglected to say I'm using Reporting Services for SQLServer 2005.
Thanks
October 24, 2007 at 9:13 am
#745005
WITH transactionsCTEAS (SELECTfactoryID,ROW_NUMBER() OVER (PARTITION BY factoryID ORDER BY transactionDate) AS rn,transactionField1,transactionField2,transactionField3FROMtransactionsTable)INSERT tblTop6SELECT factoryID,transactionField1,transactionField2,transactionField3FROMtransactionsCTEWHERErn < 7
WITH transactionsCTE
AS (SELECT
factoryID
,ROW_NUMBER() OVER (PARTITION BY factoryID ORDER BY transactionDate) AS rn
,transactionField1
,transactionField2
,transactionField3
FROM
transactionsTable)
INSERT tblTop6
SELECT
transactionsCTE
WHERE
rn < 7
This does the job for me, thanks guys!
September 26, 2007 at 7:52 am
#736379
OK I made it sound very simple.
My data looks like this in tblTransactions (all hypothetical) 🙂
Factory Item PurchasePeriod Spend
=============================
Fact1 101...
September 26, 2007 at 6:45 am
#736340