View sfmc-sql-counts-from-multiple-tables-in-one-query.sql
select
de1.count1
, de2.count2
from (
select count(*) as count1
from DataExtension1
) as de1
cross join (
select count(*) as count2
from DataExtension2
View sfmc-ampscript-first-last-days-of-the-month.html
%%[
set @today = now()
set @monthOfThisMonth = DatePart(@today, "M")
set @yearOfThisMonth = DatePart(@today, "Y")
set @firstDayOfThisMonth = dateparse(concat(@monthOfThisMonth,"/01/",@yearOfThisMonth))
set @nextMonth = dateadd(@today, 1, "M")
set @monthOfNextMonth = DatePart(@nextMonth, "M")
set @yearOfNextMonth = DatePart(@nextMonth, "Y")
set @firstDayOfNextMonth = dateparse(concat(@monthOfNextMonth,"/01/",@yearOfNextMonth))
View sfmc-ampscript-parse-first-name-from-full.html
%%[
var @full_name, @first_name
set @full_name = AttributeValue("full_name")
if indexOf(@full_name, " ") > 0 then
set @first_name = substring(@full_name,1,subtract(indexOf(@full_name," "),1))
endif
View sfmc-sql-split-remainder.sql
Select
de1.*
From [DataExtension1] de1
Left Join [DataExtensionSplit_1] split1 On (de1.[Email Address] = split1 .[Email Address])
Left Join [DataExtensionSplit_2] split2 On (de1.[Email Address] = split2.[Email Address])
Where split1.[Email Address] Is Null
And split1.[Email Address] Is Null
/* writes to DataExtensionSplit_3 */
View sfmc-sql-split-random-25-percent.sql
select top 25 percent
de1.*
from [dataextension1] de1
left join [dataextensionsplit_1] split1 on (de1.[email address] = split1.[email address])
where split1.[email address] is null
order by newid()
/* writes to dataextensionsplit_2 */
View sfmc-sql-split-random-20-percent.sql
select top 20 percent
de1.*
from [dataextension1] de1
order by newid()
/* writes to DataExtensionSplit_1 */
View sfmc-sql-last-day-of-the-month.sql
select
createdDate
from [dataExtension]
where
dateadd(dd,datediff(dd,0,createdDate), 0) =
dateadd(d, -1, dateadd(m,datediff(m,0,dateadd(dd,datediff(dd,0,getDate()), 0))+1,0))
View sfmc-sql-created-between-two-dates.sql
select
emailAddress
from [dataExtension]
where s.createdDate >= cast('2013-03-19' as date)
and s.createdDate <= cast('2013-04-19' as date)
View sfmc-sql-created-in-the-last-thirty-days.sql
select
emailAddress
from [dataExtension]
where createdDate > convert(date, getDate())
and createdDate <= convert(date, getDate()-30)
View sfmc-sql-strip-times-from-dates.sql
select
getdate() [date with time]
, convert(date, getDate()) [date without time]