I have a simple MYSQL table with about 5 columns or so. The row size of the table changes quite frequently.
One of these columns is named has_error, and is a column that has a value of either 1 or 0.
I want to create a single SQL query that will be the equivalent of the following simple equation:
(Number of rows with has_error = 1/Total number of rows in table) * 100
I can create the individual SQL queries (see below), but not sure how to put it all together.
SELECT COUNT(*) AS total_number_of_rows FROM my_table
SELECT COUNT(*) AS number_of_rows_with_errors FROM My_table WHERE has_error = 1