Answer the question
In order to leave comments, you need to log in
How to create a View in SQL with sums of table values with headers from related tables?
Completely worn out with (like) not a difficult problem.
MySQL (+php)
there is a table "data" - data on statistics
id
data - the value of the "indicator"
dataname_id - there is a table of names of "indicators" (dataname: id name, etc.)
filial_id - there is a table of branches (users: id username, etc.)
month - month of the "indicator"
year - year of the "indicator"
Need: display a table with all the indicators of all branches (users) for a specific year.
Vertically dataname_id - the names of "indicators"
Horizontally filial_id - users
In cells - the amount of a specific indicator of a specific user for the year | SELECT SUM( data ) FROM data WHERE (filial_id = branch AND data_name = parameter name data AND year = year) |
Base structure:
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question