Now on such a table, to find out the project code the same column of total revenue, SQL statement how to write, Help the hero help, come out the result is so show, hope the master to help see, in this thank
Reply to discussion (solution)
Select Project code, project name, SUM (revenue) from the table group by project code
First of all, the SQL summation must definitely require the aggregate function of MySQL sum (field name)
You need a group. Group By field names, of course
It's already written upstairs.
Upstairs, I won't repeat it.
Select AVG (' Project code '), ' project name ', SUM (' revenue ') from the table group by ' project name '
1L Group by this kind of writing seems to hang
Select Project code, project name, SUM (revenue) as revenue from table name group by project code;
Project code, project name, SUM (revenue): The column to display,
As income: give the new total revenue this column alias (call the total revenue better?),
Group BY Project code: indicates that the above query is preceded by the "Project Code" group "and then added to the calculation."
It's been solved, thank you, it's hard.