Mysql
 sql >> Datenbank >  >> RDS >> Mysql

einfache SQL-Abfrage, Ergebnisse kombinieren und dividieren

schnell und schmutzig:

select (a.count_one / b.count_two) * 100 as final_count from 
(select field_one, count(*) as count_one from table1 group by field_one) a,
(select field_two, count(*) as count_two from table2 group by field_two) b
where a.field_one = b.field_two