Case statement in MySQL
问题 I have a database table called ' tbl_transaction ' with the following definition: id INT(11) Primary Key action_type ENUM('Expense', 'Income') action_heading VARCHAR (255) action_amount FLOAT I would like to generate two columns: Income Amt and Expense Amt . Is it possible to populate the columns conditionally, using only a SQL Query, such that the output appears in the correct column, depending on whether it is an Expense item or an Income item? For example: ID Heading Income Amt Expense Amt