1

I have a db where the cells are height and width. (It's for banner ads) Some banners are the same width, but different height, or visa versa. for example: row1 hieght = 600 width = 120 row2 hieght = 600 width = 120 row3 hightt = 600 width = 90 row4 height = 125 width = 125 etc

I want to know how many rows are 600x120, how many are 600x90, etc

How do I fix the sql query as follows to get the info I want?

$sql="SELECT COUNT(`height`) GROUPED BY (`width` ) 
FROM `rv_banners` 
WHERE 1 " ;
asked Sep 19, 2014 at 18:59

1 Answer 1

3

What about something like:

select
 height || 'x' || width as dimensions,
 count(*) as number_of_banners
from
 rv_banners
group by
 height, width ;
ypercubeTM
99.7k13 gold badges217 silver badges306 bronze badges
answered Sep 19, 2014 at 19:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.