-- awstats module

select
	count(query) as "Count",
	substring(query,'screen=([0-9]+)x')::int4 as "x",
	substring(query,'screen=[0-9]+x([0-9]+)')::int4 as "y"
from
	query
where
	query ~ '[?]screen'
group by
	"x",
	"y"
order by
	"Count" desc,
	"x" desc;


select
	count(query) as "Count",
	substring(query,'[^a-z]cdi=([0-9]+)')::int4 as "Color"
from
	query
where
	query ~ '[?]screen'
group by
	"Color"
order by
	"Count" desc,
	"Color" desc;

