Uop

Published on January 2017 | Categories: Documents | Downloads: 77 | Comments: 0 | Views: 648
of 4
Download PDF   Embed   Report

Comments

Content

Pivot example
SELECT CUST, VEG, SODA, MILK, BEER, CHIPS
FROM (
SELECT CUST, PRODUCT, QTY
FROM Product) up
PIVOT (SUM(QTY) FOR PRODUCT IN (VEG, SODA, MILK, BEER, CHIPS)) AS pvt
ORDER BY CUST
--------------------------------------------------------------------------------------------Affiliate suppression list
use livecareer
DECLARE @FileName varchar(50),
@bcpCommand varchar(2000)
--,@Result varchar(200)
SET @FileName = REPLACE('c:\SuppressionList2_'+CONVERT(char(8),GETDATE(),1)+'.tx
t','/','-')
SET @bcpCommand = 'bcp "select emailaddress from livecareer.dbo.person INNER JOI
N livecareer.dbo.useroptins ON person.partyID=useroptins.partyID where optinID=2
0 and response=0 and (person.invalidemail<>1 or person.invalidemail is null) a
nd person.emailaddress is not null" queryout "'
SET @bcpCommand = @bcpCommand + @FileName + '" -T -c -CRAW'
EXEC master..xp_cmdshell @bcpCommand
---------------------------------------------------------------------------------------INSERT MailoutArticles
SELECT 214,1380,1,1,CAST(CONVERT(VARCHAR(19), GETDATE()+3, 111) as datetime),DA
TEADD (n , -1,CAST(CONVERT(VARCHAR(19), GETDATE()+10, 111) AS DATETIME) )
-----------------------------------------------------------------------------------------------------Insert mailout
Select 213,0,getdate(),NULL,'exec lcmailer.dbo.Prc_Solo_FranchiseGator 213',1,NU
LL,'LC\SpireVision.cdi','FranchiseGatorApril<90',213,'Periodic',NULL,'Solo'
-----------------------------------------------------------------------------------------------------Insert dbo.ArticleResponseMapping
select 1266,920
Insert dbo.PartnerArticles
select 84,1266,NULL,getdate(),NULL,NULL,NULL
--------------------------------------------------------------------------------------------------------------------------------select * from userfeatures
Insert feature
Select 188,'slot breakdown report','/admin/Reports/SlotBreakdownPerformanceRepor
t.aspx','REPT',0
Insert Rolefeatures
Select 100,188
Insert userfeatures
Select 7214773,188

-------------------------------------------------------------------------------------------------------------------------PlattForm data
select
p.partyID,
P.firstname,
p.lastname,
P.Emailaddress,
a.Address,
a.city,
a.state_province,
a.postalcode,
p.creationdate,
P.Phone
from offerevent oe
INNER JOIN offer o ON o.offerID=oe.offerID AND o.offertypecd='FULL'
AND oe.status not in ('LEAD','ACCP')
INNER JOIN PERSON p On p.partyID=oe.partyID
and p.creationdate>='2010-07-14' AND p.creationdate<'2010-07-22'
AND DATEDIFF(Year, P.BirthDate, GETDATE()) > 17
INNER JOIN personaddress pa On p.partyID=pa.partyID and pa.addresstypecd='HOME'
INNER JOIN address a ON a. addressID=pa.addressID
and a.CountryID=164
AND (p.phone<>'' or p.phone<>NULL)
where p.emailaddress not like '%@livecareer.com'
ORDER by P.PartyID desc

-------------------------------------------------------------------------------------------------------------------DECLARE @FileName varchar(200)
--chargeback_195.27.175.132_20101018_0000003162FFCA87
SET @FileName = 'chargeback_195.27.175.132_'+REPLACE(CONVERT(VARCHAR(10), GETDAT
E(), 120), '-', '')+'_0000003162FFCA87'+'.txt'
print @FileName
------------------------------------------------------------------------------------------------------------------------DECLARE @FileName varchar(50),
@bcpCommand varchar(2000)
SET @FileName = REPLACE('Z:\PartnerDataTransfer\Active\Platform\PlattformRecords
_'+CONVERT(char(8),GETDATE(),1)+'.txt','/','-')
SET @bcpCommand = 'bcp "EXEC Livecareer.dbo.prc_PlattFormRecords_Get ''2010-07-2
9'',''2010-08-05''" queryout "'
SET @bcpCommand = @bcpCommand + @FileName + '" -T -c -CRAW'
EXEC master..xp_cmdshell @bcpCommand
print @bcpCommand
________________________________________________________________________________
____________________
select a.affiliatename,ap.adpanelCD,ad.description,ld.[lead $],ld.lead,
cl.refererID,imp.impression,cl.clicks,lg.[logged in],

rp.[Report $],rg.registered
From dbo.clickstemp cl
LEFT JOIN dbo.imprtemp imp ON cl.refererID=imp.referrerID
Left join dbo.Leadtemp ld ON ld.referrerID=imp.referrerID and ld.adunitID=cl.ad
unitID
LEFT JOIN dbo.LoggedTemp lg ON lg.ReferrerID=ld.referrerID and lg.adunitID=ld.a
dunitID
--LEFT JOIN dbo.clickstemp cl ON lg.ReferrerID=cl.refererID and lg.adunitID=cl.a
dunitID
LEFT JOIN dbo.regtemp rg ON rg.ReferrerID=lg.referrerID and lg.adunitID=rg.aduni
tID
LEFT JOIN dbo.reptemp rp ON rg.ReferrerID=rp.referrerID and rg.adunitID=rp.aduni
tID
Left join adunit ad ON cl.adunitID=ad.adunitID
Left join referrer r On cl.RefererID=r.referrerID
Left JOIN adpanel ap on ap.referrerID=r.referrerID
INNER join affiliate a on a.affiliateID=r.affiliateID order by 1,2
-----------------------------------------------------------------------select data,sum(amount)
from vw_hitlog hl with (nolock)
inner join session s with (nolock) on s.tag=hl.tag
inner join person p with (nolock) on p.partyId=s.partyId
inner join Revenue r with (nolock) on r.partyId=p.partyId AND r.timestamp>='201
0-05-12' AND r.timestamp<='2010-05-21'
and r.revenuetypecd in ('LEAD','ITLD')
where hl.referrerID=8752 AND data in ('47','132','57','137','138')
and hittype='ac' and hl.timestamp>='2010-05-12'
and hl.timestamp<='2010-05-21' group By data
-------------------------------------------------------------------------------------------------select * from sys.objects where (create_date >='2010-04-01') and (type='u') ord
er by 1
----------------------------------------------------------------------------------------------------select Top 200 u.partyID,u.username, u.password,pu.userlevelID as 'Status' from
[user] u Inner Join productUser pu on pu.partyID=u.partyID
And pu.UserlevelID=1 and pu.productID=10 and Username is not NULL
And Password is not null order by 1 desc
-----------------------------------------------------------RB Data
select Top 100 u.partyID,u.username, u.password,pu.userlevelID as 'Status' from
[user] u Inner Join productUser pu on pu.partyID=u.partyID
AND pu.registeredon>='8/9/2010' and pu.registeredon< '8/15/2010'
AND pu.userstageID=14 and pu.productID=10 and Username is not NULL
And Password is not null order by 1 desc
----------------------------------------------------------------------------------------------------12457281(initially 100.35)
select Top 100 u.partyID,u.username, u.password,pu.userlevelID as 'Status' from
[user] u Inner Join productUser pu on pu.partyID=u.partyID
AND pu.registeredon>='8/9/2010' and pu.registeredon< '8/15/2010'
AND pu.userstageID=16 and pu.productID=10 and Username is not NULL
And Password is not null order by 1 desc
select Top 100 u.partyID,u.username, u.password,pu.userlevelID as 'Status' from

[user] u Inner Join productUser pu on pu.partyID=u.partyID
INNER JOIN Documents.dbo.document d ON d.partyID=u.partyID
AND pu.registeredon>='8/9/2010' and pu.registeredon< '8/15/2010'
and pu.productID=10 and Username is not NULL
And Password is not null order by 1 desc
-----------------------------------------------------------------------------------------INSERT Commission
Select 161,NULL,HitlogID,0.18,'ct',timestamp,referrerID,10 from vw_hitlog
where ReferrerID in (9078,9079,9080)AND timestamp>'2010-08-20'
AND visittype='n' AND hitlogid not in (select hitlogid from commission where aff
iliateID=161)
----------------------------------------------------------------------------select * from Affiliateproducts ap
inner join Referrer r on r.affiliateId=ap.affiliateId
inner join person p on p.referrerId=r.referrerId
inner join Billingsubscription bs on bs.partyId=p.partyID
where ap.productId=10 and r.productId=10 and ap.mode='rs' and ap.payout>=1
and not exists(select partyid from commission where mode='rs')
select * from commission where partyID in (10055009,10039095,10049464,10411103,1
0610118)
select * from affiliate where affiliateid in (486,697,680)
---------------------------------------------------------------------------ERROR LOG
select * from errors er Left join errorstackitem esi on er.errorId=esi.errorId
where timestamp>='2010-09-12' and timestamp<'2010-09-13'
and er.description Not like 'I#%' order by 1
--------------------------------------------------------------------select * from offer where offercd='APUPO7'
select * from offercustomfields where offerID=914
select * from customfield where customfieldID=358
select * from customanswer where customfieldID=358 and isactive=1
CustomAnswerID
IsDefault
6918
358
4838
358
1YR
1
4845
358
NULL

CustomFieldID

Value

SortIndex

Alias

Have High School GED
11
GED
1
Completed 0-23 Credits (1 year) of College
NULL
Graduating High School in 2011 or after 9

IsActive
NULL
12

COLLEGE

HS-Some 1

---------------------------------------------------------------------------------------update billingsubscription set scheduletypecd='MNTH',Billingstatustypecd='ACTV
',skuid=10022,Nextbillingdate=startdate+7,expirydate=startdate+7,amount=34.95 wh
ere partyId=11670985
--update productuser set userlevelID=1 where productID=10 and partyID=9151034

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close