Last active
August 29, 2015 13:56
-
-
Save cdeutsch/9122998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT 34 AS [product_id], | |
| SUBSTRING(CAST(NEWID() AS nvarchar(50)), 1, 5) + '-' + SUBSTRING(CAST(NEWID() AS nvarchar(50)), 1, 5) + '-' + SUBSTRING(CAST(NEWID() AS nvarchar(50)), 1, 5) + '-' + SUBSTRING(CAST(NEWID() AS nvarchar(50)), 1, 5) + '-' + SUBSTRING(CAST(NEWID() AS nvarchar(50)), 1, 5) AS [license_code], -- can we gen this from SQL or join into a table of available codes? | |
| 0 AS [refunded], | |
| UniversityStartDate AS [purchase_ts], | |
| null AS [order_id], | |
| CustomerID AS [customer_id], | |
| CustomerID AS [user_id], | |
| UniversityStartDate AS [first_activation_ts], | |
| UniversityEndDate AS [valid_until_ts], | |
| NULL AS [grandfather_price], | |
| 'XU SUB' AS [sold_as_sku], | |
| NULL AS [original_product], | |
| 0 AS [grandfather_status] | |
| FROM Nop_Customer | |
| WHERE UniversityStartDate IS NOT NULL | |
| AND UniversityEndDate IS NOT NULL | |
| AND NOT EXISTS(SELECT * FROM xam_Vendor_Licenses WHERE sold_as_sku = 'XU SUB' AND customer_id = Nop_Customer.CustomerID) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment