Select the project, the sum (amount) as the summary from shouruzhichu where brand='good Fried o' and the & lt;> 'members' top-up' GROUP BY project order BY summary
I will only written out, not a list of more
CodePudding user response:
The CREATE TABLE # A (
The VARCHAR (20),
The value of the INT
)
# INSERT INTO A VALUES (' take-away ', 500)
# INSERT INTO A VALUES (' take-away ', 500)
# INSERT INTO A VALUES (' members' top-up ', 500)
# INSERT INTO A VALUES (' take-away ', 500)
# INSERT INTO A VALUES (' members' top-up ', 500)
# INSERT INTO A VALUES (' take-away ', 500)
SELECT
The SUM ((CASE WHEN a. the='members' top-up' THEN 0 ELSE a. amount END)) non-members top-up,
The SUM ((CASE WHEN a.='members' top-up' THEN a. the amount the ELSE 0 END)) member prepaid phone
The FROM # aa
DROP TABLE # A
Is the effect?
Non-members top-up member prepaid phone
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
2000, 1000,