mysql - SQL Count Columns in Row Equal to Specific Value -
I have a registration table in which many columns have values like "in progress" or "submit". I am trying to count how many of these columns are equal to "submitted", so I can set a percent completion for the user. Returns the query below only 1 or 1 because it only asks one column, but how can I include others? For example, I should count how many of the following columns are "submitted" or "acceptable":
network_user_status work_ed_status chores_status class_schedule_status registration number (ID) with registration WHERE user name = "Ajaxan" and nomination_progress_all = "approved" or nomination_grad_state = "submit"
firstly , Your query is not doing what you think is doing it. Username
condition is only applying for "Approved" I'm pretty sure that you mean:
WHOSE username from registration = 'ajaxen' and ' Nominated ',' Submit '' 'from nomination_andx_status (id)
If you want to count one or both values or both, use conditional aggregation. It is easy in MySQL:
is selected as the calculation (ID), the amount (nomination_gradist_status = 'acceptable'), submit from the registration in the form of amount (nomination_gredi_status = 'deposit') Where the user name 'ajackson';
Comments
Post a Comment