Not being a savvy SQL programmer, I'm in a following pickle. From a table I can select as follows.
select Sign as Siggy, Value as Greeky from Table
where ID = 1
This presents me with following output.
Siggy Greeky
a-ish alpha
b-ish beta
c-ish gamma
The problem is that, for reason not discussed here and not affectable, I need it to be like this.
A-ish B-ish C-ish
alpha beta gamma
Important to note is that I do know for absolutely sure that there's a fix number of elements (possibly null valued). I can safely assume that the number of columns mapped into from the rows is three or less.
I attempted to resolve it by joins like so.
select T1.ID, T1.Value, T2.Value, T3.Value
from Table as T1
join Table as T2 on T2.ID = T1.ID and T2.Siggy = 'b-ish'
join Table as T3 on T3.ID = T1.ID and T2.Siggy = 'c-ish'
This produces a first row that is what I need but it's repeated (and variating somewhat) because, as I suspect, the ON addition to JOIN statements isn't in effect for FROM.
I can get the first row only but it'd be nice to make it more optimal. How?!
Please not that pivotation isn't the way to go here because I've got a fixed limit of rows to be transposed and I need to respect that the output of columns doesn't exceeds that number.