dimanche 13 décembre 2015

How to specify column type in select statement sqlite

So I have a table of impressions and clicks, and I want to find the click through rate on a particular day. My query is like this:

select sum(impressions), sum(clicks), sum(clicks) / sum(impressions) as CTR
from table
where date = '1-1-2015';

The clicks are very small compared to impressions and I'm just getting a 0 for the CTR column. How can I specify it to be of float type so that I get a proper decimal value instead of just 0?

Aucun commentaire:

Enregistrer un commentaire