Vision Global TicketSalesScript: Difference between revisions
No edit summary |
No edit summary |
||
| Line 9: | Line 9: | ||
FROM TicketEventCodes | FROM TicketEventCodes | ||
WHERE CAST(CreatedDate AS DATE) = | WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date) | ||
) | ) | ||
Latest revision as of 20:23, 3 November 2023
------------------------------------------------------------------------------
-- check to verify the ticket import completed succesfully, change date to the day you run the import
------------------------------------------------------------------------------
( SELECT EventCode
FROM TicketEventCodes
WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date)
)
------------------------------------------------------------------------------
-- Change date to date of most recent ticket import
------------------------------------------------------------------------------
-- check to verify no records returned in following query. If so, do not run anything below
------------------------------------------------------------------------------
SELECT *
FROM TicketSales
WHERE distid >= 2147483647
AND EventCode IN
(
SELECT EventCode
FROM TicketEventCodes
WHERE CAST(CreatedDate AS DATE) = CAST(getdate() as date)
)
------------------------------------------------------------------------------
-- Run top query and copy sponsor ids into second query
------------------------------------------------------------------------------
-- Update distIDs in first query to have sponsor of current sponsor. Usually returns 3 distIDs.
-- aka update sponsor of distIDs in first query to their sponsor's sponsor
------------------------------------------------------------------------------
select *
from DistributorDetail
where sponsorid >= 2147483647
and distid < 2147483647
select DistID, SponsorID, *
from distributordetail
where distid in ()
update DistributorDetail
set SponsorID = , UplineDID =
where distid =
------------------------------------------------------------------------------
-- Run queries and change "select *" to "Delete" and run
------------------------------------------------------------------------------
select *
from Payment
where orderid in
( select OrderID
from orders
where distid >= 2147483647
)
select *
from orderlines
where orderid in
(
select OrderID
from orders
where distid >= 2147483647
)
select *
from orders
where distid >= 2147483647
select *
from DistributorDetail
where distid >= 2147483647
select *
from Distributor
where distid >= 2147483647