This is probably a naughty use for sql… But here it goes….
I have a table:
Banners
--------------
BannerID
request_t0
clicks_t0
request_t1
clicks_t1
...
request_t6
clicks_t6
Using the number of requests and clicks, I calculate a ctr (clicks to impressions ratio) for each set….
ctr_t0 = clicks_t0 / request_t0 * 100
So now I have 6 separate CTRs in each row….
For output, I would like the count of how often each CTR is the highest in it’s row…
So given the set:
ctr_t0 ctr_t1 ctr_t3
------ ------ ------
2.39% 1.24% 1.5%
1.4% 2.46% 2.2%
3.1% 2.45% 1.45%
I would like as my result:
ctr_t0_count ctr_t1_count ctr_t3_count
------------ ------------ ------------
2 1 0
Any ideas on how to do this w/o learning a programing language? 🙂
where within select there is your previous query.