Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias Coetzee tobiascoetzee

View GitHub Profile
@tobiascoetzee
tobiascoetzee / dayproducttotal-window.sql
Created Jun 2, 2018
SQL query that returns a list of all the products sold with a running total for each product and each day plus a total for each day and product using Windows over function
View dayproducttotal-window.sql
SET NOCOUNT ON;
SELECT
ProductID
,ModifiedDate
,UnitPrice
,SUM(UnitPrice) OVER (
PARTITION BY ModifiedDate
ORDER BY ProductID, ModifiedDate, SalesOrderID
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) ASModifiedDateBalance
@tobiascoetzee
tobiascoetzee / dayproducttotal.sql
Last active Jun 2, 2018
SQL query that returns a list of all the products sold with a running total for each product and each day plus a total for each day and product.
View dayproducttotal.sql
SET NOCOUNT ON;
DECLARE @Balances AS TABLE
(
ProductId INT
,ModifiedDate DATETIME
,UnitPrice MONEY
,ModifiedDateBalance MONEY
,ProductIdBalance MONEY
,ModifiedDateTotal MONEY
View gist:7789832
class ValidationChecker():
def __init__(self, validationContext, validationsFile, validationsModule):
self.Context = validationContext
self.Errors = {}
self.__validationsTree = self.__LoadFile(validationsFile)
self.__module = __import__(validationsModule)
def __LoadFile(self, validationsFile):
base = ''