Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- dbo.usp_Parse_domain_name_v5(ContactRecord.URL),
- COUNT(ContactRecord.ContactId) AS TOTAL_IMPRESSIONS,
- COUNT(DISTINCT ContactAttribute.ContactAttributeValue) AS UNIQUE_IMPRESSIONS,
- COUNT(DISTINCT LEADS.LEAD_ID) AS CONVERSIONS,
- MAX(convert(varchar(10), ContactRecord.CallStartDateTime, 102)) AS 'DATE'
- FROM
- ContactAttribute
- LEFT JOIN ContactRecord ON ContactRecord.ContactId = ContactAttribute.ContactId AND ContactAttribute.ContactAttributeName = 'IP'
- LEFT JOIN LEADS
- ON LEADS.LEAD_ID = ContactRecord.ContactId
- AND LEADS.EMAIL IS NOT NULL AND LEADS.PHONENUMBER IS NOT NULL
- AND LEADS.FIRSTNAME IS NOT NULL AND LEADS.LASTNAME IS NOT NULL
- WHERE
- convert(varchar(10), ContactRecord.CallStartDateTime, 102) = '2019.05.16'
- GROUP BY
- dbo.usp_Parse_domain_name_v5(URL)
- ORDER BY
- COUNT(ContactRecord.ContactId) DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement