I have a table in MYSQL named as permit_bills which contains columns as bill_no, alcohol_typ, origin, 2000ml, 1000ml, bill_date. Table is shown below:
+---------+--------------+---------+--------+--------+-----------+
| bill_no | alcohol_typ | origin | 2000ml | 1000ml | bill_date |
+---------+------------- + --------+--------+--------+-----------+
| 2001 | s | f | 2 | 1 |01-02-2017 |
| 2001 | m | w | 3 | 4 |01-02-2017 |
+---------+--------------+---------+--------+--------+-----------+
I want to select all rows from above table into a single row based on their bill_no and bill_date and want to display the columns of 2000ml and 1000ml as per their alcohol_typ and `origin.
My output table must be like this:
+---------+--------------+-------------+------------+------------+-----------+
| bill_no | s_f_2000ml | s_f_1000ml | m_w_2000ml | m_w_1000ml | bill_date |
+---------+------------- + ------------+------------+------------+-----------+
| 2001 | 2 | 1 | 3 | 4 |01-02-2017 |
+---------+--------------+-------------+------------+------------+-----------+