I am tracking two different pages when a person leaves my site and signs up with a merchant partner.
When the person leaves my site to the merchant's landing form page I enter information about that person in my database table called 'tracking'.
When that person successfully fills out the form on the merchant site a few minutes later I use a tracking pixel on the success/thankyou page to also enter info about that person.
Both hits are stored to the same table called 'tracking'. The only difference is on the event that the tracking pixel is fired it places a '1' in the 'thankyou' column.
What I want to do is then group these two events by matching the ipAddress, browser info and the day it happened.
67.222.333.44 | Chrome browser blah, blah | 2011-02-08 10:38:15 | thankyou=0
67.222.333.44 | Chrome browser blah, blah | 2011-02-08 10:41:46 | thankyou=1
But I am not sure how to go about writing the query so I can output the query correctly. All I want to return is one record per group.
When the person leaves my site to the merchant's landing form page I enter information about that person in my database table called 'tracking'.
When that person successfully fills out the form on the merchant site a few minutes later I use a tracking pixel on the success/thankyou page to also enter info about that person.
Both hits are stored to the same table called 'tracking'. The only difference is on the event that the tracking pixel is fired it places a '1' in the 'thankyou' column.
What I want to do is then group these two events by matching the ipAddress, browser info and the day it happened.
67.222.333.44 | Chrome browser blah, blah | 2011-02-08 10:38:15 | thankyou=0
67.222.333.44 | Chrome browser blah, blah | 2011-02-08 10:41:46 | thankyou=1
But I am not sure how to go about writing the query so I can output the query correctly. All I want to return is one record per group.
Code:
<!--- Get matching IP, date range and browser info --->
<cfquery name="GetSuccessLeads" datasource="#DSN#" >
SELECT cs, browserinfo, thankyou, affCompany, amount, referrer, ipAddress, timeStamp
FROM tracking
WHERE thankyou = '1'
GROUP BY timeStamp,
browserinfo,
timeStamp
</cfquery>
<cfoutput query="GetSuccessLeads">
#ipaddress#, #browserinfo#, #timeStamp#, #amount#, #cs#, #referrer#<br >
</cfoutput>