I am having table as mentioned in attached screen where Tagindex containns duplicate entries for taht particular tag i want to use tagindex distict as a header and the value belongs to hat tag will appear below that tagindex as shown in figure attached.is it doable.
SELECT 'TagIndex' AS parameter,
[0], [1], [2], [3], [4]
FROM
(SELECT millitm, val
FROM floattable) AS SourceTable
PIVOT
(
avg(val)
FOR millitm IN ([0], [1], [2], [3], [4])
) AS PivotTable;
IIUC: What you are asking is for SQL to produce a non-relational result. Basically a query that returns rows with multiple, identical column names.
If you get a query that works, and you have four columns called Tagindex, how will you tell them apart?
also, if you paste your source data as:
CREATE TABLE
INSERT INTO
that it's easier for forum contributors to work with. Not many people would hand-type from your screenshot of the original table.