Account Inspection Query
SQL Queries
set @acctID = 0;
select * from accounts where id = @acctID;
select * from cards where accountid = @acctID;
select * from shoppers where accountid = @acctID;
select sa.* from shopperaddresses sa
join shoppers s on s.id = sa.ShopperID and s.AccountID = @acctID;
select * from balances where accountid = @acctID;
select * from account_types where id in (select typeid from account_has_types where accountid = @acctID);
select oao.ID PinID, oao.AccountID, o.Name Offer, oam.AssignMethod, oao.MultiUse, oao.Used, oao.UsedDate, oao.Created, oao.LastUpdatedWith, oao.LastUpdatedBy, oao.LastUpdatedTime
from offers_account_offer oao
join offers o on o.id = oao.OfferID
left join offers_assign_methods oam on oam.ID = oao.AssignMethod
where oao.accountid = @acctID;
select * from pointstransactions where accountid = @acctID;
select * from rewardstransactions where accountid = @acctID;
select * from overtimetransactions where accountid = @acctID;
select * from transactions where accountid = @acctID;
select cpl.ID ProgressiveID, cpl.EntryTypeID, cplt.LedgerType, cpl.AccountID,
cpl.TransactionDateTime, cpl.StoreNum, cpl.StoreID, cpl.TerminalID, cpl.POS_TransactionID,
cpl.CPR_ID, cpr.Name CPRName, cpl.ContinuityAmount, cpl.ContinuityReset, cpl.ConsecutivePeriod, cpl.RewardID, r.description Reward, cpl.CreditAmount, cpl.OfferID, o.Name Offer,
cpl.LastUpdatedWith, cpl.LastUpdatedBy, cpl.LastUpdatedTime
from cp_ledger cpl
join llhub.cp_ledger_types cplt on cplt.id = cpl.EntryTypeID
left join cp_rewards cpr on cpr.id = cpl.CPR_ID
left join rewards r on r.id = cpl.RewardID
left join offers o on o.id = cpl.OfferID
where cpl.accountid = @acctID
order by cpl.TransactionDateTime, cpl.EntryTypeID;