select count(seats_count2) as rows_count, sum(seats_count2) as seats_count
from (select count(seat_num) as seats_count2
from (select left(seat_no,-1) as seat_num,substring(seat_no from '.$') as seat_char
from seats
where aircraft_code= (select aircraft_code from aircrafts_data where model->>'en'='Boeing 777-300')) sq
group by seat_num) sq2