Skip to content
Advertisement

SQL Update Multiple columns with counts

We currently have SQL update statements that works for our needs and updates the tbl_rprt table. Below are some of the update queries, there are several others like them. I was wondering if there was another way to get this done, maybe combining all of them into one SQL statement. #tbl_rprt is a report of all the counts of specific flags in wrk_tbl_flgs for each class and room rm.

Update wrk_tbl_flgs has student_id and specific flags

Advertisement

Answer

As it stands you can combine into one, using conditional sums as follows:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement