<@U01MA5829D1> I remember running into this before...
# suiteql
t
@Alan Fitch I remember running into this before, and I never could determine what the problem is. It's as if any use of the OVER clause is evaluated as ROWS UNBOUNDED PRECEDING. It seems to me that this is either a limitation of SuiteQL and/or the version of Oracle that NetSuite is running on. Here's a query that I worked up to compare the two ranges:
Copy code
SELECT
	Transaction.Type,
	Transaction.TranID,
	Transaction.TranDate,
	BUILTIN.DF( Transactionline.Item ) AS ItemName,
	TransactionLine.NetAmount,
	AVG( TransactionLine.NetAmount )
		OVER (
			ORDER BY
				Transaction.TranID
			RANGE BETWEEN 3 PRECEDING AND CURRENT ROW 
		) AS RollingNetAmtAvg1,
	AVG( TransactionLine.NetAmount )
		OVER (
			ORDER BY
				Transaction.TranID
			ROWS UNBOUNDED PRECEDING
		) AS RollingNetAmtAvg2
FROM 
	Transaction
	INNER JOIN TransactionLine ON 
		( TransactionLine.Transaction = Transaction.ID )
WHERE 
	( Transaction.Type = 'PurchOrd' )
	AND ( Transactionline.Item = 119 )
ORDER BY
	Transaction.TranID
What surprises me the most is that it doesn't throw a parse error. Instead, it just seems to ignore the range. That being said, if you try using "ROWS 3 FOLLOWING" as the range, it will throw an error.