there are 2 mysql table like this
table 1
–id—–config_name
–1—–OS
–2—–Control Panel
–3—–Bandwidth
table 2
id — config_id— config_Option_name — Price
1——–1————-Windows 2008——–20.00
2——–1————-CentOs 5—————-0.00
3——–2————-whm/cPanel———–30.00
4——–2————-Plesk——————-50.00
Now I want to show them like this, ONLY USING MYSQL.
- OS
Windows 2008 = 20.00
CentOs 5 = 00.00
- Control Panel
whm/cPanel= 30.00
Plesk = 50.00
IS THIS POSSIBLE? So now “os” or “control panel” are selected once although if we use group by or join it comes twice.
Using single SQL statement
Don’t use SQL to format output like this. You should do it on a client side.
Anyway here is a query to do it in SQL only (SQLFiddle demo):