I have a table like this in SQL ( it is not in order )
A B VAL VAL2
---------------------------------------------
1 1 -2.1846000000000e+02 0.0000000000000e+00
2 2 -2.1846000000000e+02 0.0000000000000e+00
3 2 6.4000000000000e+01 0.0000000000000e+00
1 2 6.4000000000000e+01 0.0000000000000e+00
2 3 6.4000000000000e+01 0.0000000000000e+00
3 3 -2.1846000000000e+02 0.0000000000000e+00
3 1 6.4000000000000e+01 0.0000000000000e+00
2 1 6.4000000000000e+01 0.0000000000000e+00
1 3 6.4000000000000e+01 0.0000000000000e+00
So each tuple A,B represents a point of a matrix
How can i convert that into an actual matrix like
A1 A2 A3
--------------------------------------------------------------------
-2.1846000000000e+02 6.4000000000000e+01 6.4000000000000e+01
6.4000000000000e+01 -2.1846000000000e+02 6.4000000000000e+01
6.4000000000000e+01 6.4000000000000e+01 -2.1846000000000e+02
Given table M (x, y, v)
, ...means continue the series as needed but don’t leave it in the scriptDemo: http://www.sqlfiddle.com/#!3/7ee1e/17 (thanks to mellamokb for the setup script)