Home > database >  Give great god to see, where
Give great god to see, where

Time:11-07

SELECT b. ` serial number `, b. ` ID + ` charging pile, the SUM (IFNULL (a. ` charge capacity `, 0)), SUM (IFNULL (a. ` charge electricity `, 0)), COUNT (a. ` serial number `), SUM (IFNULL (a. ` charging fees `, 0))
The FROM ` trading record ` AS A, ` pile information table (run) on data ` AS B
WHERE a. ` charging pile ID `=b. ` charging pile ID + `
GROUP BY b. ` charging pile ID + `
The ORDER BY b. ` serial number `

Query data delete empty value, want to leave empty value of pile, how to change?

CodePudding user response:

Null values of pile is what meaning, which fields in a table?

CodePudding user response:

WHERE a. ` charging pile ID `=b. ` charging pile ID + ` (+)

CodePudding user response:

The aggregated fields are in the group by clause,

CodePudding user response:

SELECT b. ` serial number `, b. ` ID + ` charging pile, the SUM (IFNULL (a. ` charge capacity `, 0)), SUM (IFNULL (a. ` charge electricity `, 0)), COUNT (a. ` serial number `), SUM (IFNULL (a. ` charging fees `, 0))
The FROM ` trading record ` AS A, ` pile information table (run) on data ` AS B
WHERE a. ` charging pile ID `=b. ` charging pile ID + `
GROUP BY b. ` charging pile ID + ` , b. ` serial number `
The ORDER BY b. ` ` serial number
  • Related