Need SQL help
I'm embarrassed to admit it, but I need a little SQL help. The truth is, I suck when it comes to SQL. I guess I'm not disciplined enough to really become a guru.
I'm serving ads, and I have two queries. One counts impressions, the other clicks. They look like this:
SELECT COUNT(*) AS ImpressionCount, CONVERT(nvarchar, Impressions.ServeTime, 101) AS ServeTime
FROM Impressions
WHERE Impressions.CreativeID = 15
GROUP BY CONVERT(nvarchar, Impressions.ServeTime, 101)
ORDER BY CONVERT(nvarchar, Impressions.ServeTime, 101)
SELECT COUNT(*) AS ClickCount, CONVERT(nvarchar, Clicks.ClickTime, 101) AS ServeTime
FROM Clicks
WHERE Clicks.CreativeID = 15
GROUP BY CONVERT(nvarchar, Clicks.ClickTime, 101)
ORDER BY CONVERT(nvarchar, Clicks.ClickTime, 101)
What I'd like to do is combine them into one set of results, three columns: ImpressionCount, ClickCount and ServeTime (one for each date). The idea is to roll that into a new table for faster querying, since the data will never change. How do I do that? If my methodology “ain't right,” feel free to poke fun or help.