MYSQL:将行转换为列

时间:2016-05-20 05:46:53

标签: mysql

查询:

SELECT  currency,alert_level,side, 
range_start,range_end      FROM   
AESFX_ALERT_CONFIG order by 
Side,Alert_Level

输出

output

但我想要这样的输出:

enter image description here

我尝试了CASE,但这并没有解决我的问题。

1 个答案:

答案 0 :(得分:0)

在您的选择

中使用<form role="form" name="form1" action="Registration" method="post" class="signup-form"> <div class="form-group"> <select onchange="document.getElementById('country').value=this.options[this.selectedIndex].text; document.getElementById('idValue').value=this.options[this.selectedIndex].value;"> <option></option> <option value="sl">Sri Lanka</option> <option value="jp">Japan</option> <option value="en">England</option> <option value="kr">Korea</option> <option value="us">USA</option> </select> <input name="country" placeholder="Select Your Country" id="country" onfocus="this.select()" type="text" required> </div> <div class="col-md-4"> <select id="city" name="city" class="form-control"> <option>--Select--</option> </select> <label id="city1" class="input-group-error form-error"></label> </div> </form> 谓词

请参阅https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html