Home > database >  Mysql in the table for a particular certain values, operation for addition, subtraction, multiplicat
Mysql in the table for a particular certain values, operation for addition, subtraction, multiplicat

Time:03-07

Assuming that there is a table, the name of daxue, see below, now I need to according to the first column value, after the search operation: (+ 8000) 51205-30005 * 9200/4000, how to use the mysql statement expressing

CodePudding user response:

 
Select (total - ordinary undergraduate specialty + adult undergraduate specialty) * undergraduate course specialized subject graduate/network from
(
Select
The sum (case when id=1 then students several year statements else 0 end) in total,
The sum (case when id=2 then students several year statements else 0 end) ordinary undergraduate course specialized subject,
The sum (case when id=5 then students several year statements else 0 end) adult undergraduate course specialized subject,
The sum (case when id=11 then students several year statements else 0 end) graduate student,
The sum (case when id=8 then students several year statements else 0 end) network undergraduate college
The from daxue
) a;

CodePudding user response:



Thanks for the great god, new problems come, now suppose you have two tables, named daxue1 and daxue2, as Desmond tutu, need after the search operation: (+ 8000) 51205-30005 * 9200/4000 + 1888, how to express in mysql statement,

CodePudding user response:

You are # 1 for you behind the expression of the plus + (select increase the total number of students from daxue2 where id=5)