我有一张表select name, id, 'jan' as month, jan as value
union
select name, id, 'feb' as month, feb as value
union
select name, id, 'mar' as month, mar as value
union
select name, id, 'apr' as month, apr as value
union
select name, id, 'may' as month, may as value
:
我需要将表转置为:
用户需要将列更改为行值
我使用以下声明尝试了它
function gettData(columnNbr,rowNbr){
var details=[];
$(document).ready(function() {
$("#myModal").modal({
//keyboard: true,
//backdrop: "static",`enter code here`
//show:false,
}).on("show", function(){
});
$scope.getHOTData();
//I am calling method to load data for handson table
});
}
HTML content
<div class="modal modal-wide fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title"><b>Title</b></h4>
</div>
<div class="modal-body">
<div htable id="idHOT" data="data"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
但这会在12条记录中切割每条记录吗?
有没有更好的方法呢?
答案 0 :(得分:2)
Unpivot就是你要找的。我现在无法测试结果,但解决方案应如下所示:
float texelSizeX = 1.0/fWidth*0.998;
float texelSizeY = 1.0/fHeight*0.998;