Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
COMP     500     300     100       30      10      3
7977797 19.67    NULL    NULL    NULL    NULL    NULL
7977797 NULL    NULL    NULL    NULL    NULL    NULL
7977797 NULL    NULL    NULL    NULL    NULL    NULL
7977797 NULL    -3.99    NULL    NULL    NULL    NULL
7977797 NULL    NULL    -7.92    NULL    NULL    NULL
7977797 NULL    NULL    NULL    -27.3   NULL    NULL
7977797 NULL    NULL    NULL    NULL    -145.2  NULL
7977797 NULL    NULL    NULL    NULL    NULL    -86.26
7977797 NULL    NULL    NULL    NULL    NULL    NULL
7977797 NULL    NULL    NULL    NULL    NULL    NULL
7977797 NULL    NULL    NULL    NULL    NULL    NULL
7977797 17.68    NULL    NULL    NULL    NULL    NULL
7977797 NULL    NULL    NULL    NULL    NULL    NULL
7977797 NULL    NULL    NULL    NULL    NULL    NULL
7977797 NULL    -7.68    NULL    NULL    NULL    NULL
7977797 NULL    NULL    -7.70    NULL    NULL    NULL
7977797 NULL    NULL    NULL    -33.07   NULL    NULL
7977797 NULL    NULL    NULL    NULL    -40.45   NULL
7977797 NULL    NULL    NULL    NULL    NULL    -58.82


how do i make it in the same row i,e i want to remove null values how do i do that????
note ; i make this table by using view..
please help me

[Update]
thank you for responding i want to display it as folloe

COMP     500     300     100       30      10      3
7977797 19.67   -3.99    -7.92   -27.3  -145.2   -86.26

7977797 17.68   -7.68   -7.70  -33.07   -40.45    -58.82




the following "
with PivotData as
SQL
(SELECT TOP 1000 [WELLPOSITION]
      ,[COMPOUND_NAME]
      ,[CON_VALUE]
      ,[VALUE]
      ,[DATA_TYPE]
      ,[REPLICATES]
      ,[CONCENTRATION]
      ,[ASSAY_TYPE]
      ,[PLATE_ID]
      ,[Expr1]
  FROM [AFileStorageDB].[dbo].[View_1] where DATA_TYPE='% Inhibition')
  
  SELECT [COMPOUND_NAME],[500],[300],[100],[30],[10],[3],[1],[0.3],[0.1],[0.03],[0.01] from PivotData
  PIVOT 
  (sum(VALUE)
  FOR CON_VALUE IN ([500],[300],[100],[30],[10],[3],[1],[0.3],[0.1],[0.03],[0.01])
  )as PivotResult


" it the
Posted
Updated 27-Sep-15 1:18am
v2
Comments
Patrice T 27-Sep-15 0:02am    
Show what result you want.
Member 11819086 27-Sep-15 4:43am    
thank you for responding i want to display it as folloe

COMP 500 300 100 30 10 3
7977797 19.67 -3.99 -7.92 -27.3 -145.2 -86.26

7977797 17.68 -7.68 -7.70 -33.07 -40.45 -58.82



the following "
with PivotData as
(SELECT TOP 1000 [WELLPOSITION]
,[COMPOUND_NAME]
,[CON_VALUE]
,[VALUE]
,[DATA_TYPE]
,[REPLICATES]
,[CONCENTRATION]
,[ASSAY_TYPE]
,[PLATE_ID]
,[Expr1]
FROM [AFileStorageDB].[dbo].[View_1] where DATA_TYPE='% Inhibition')

SELECT [COMPOUND_NAME],[500],[300],[100],[30],[10],[3],[1],[0.3],[0.1],[0.03],[0.01] from PivotData
PIVOT
(sum(VALUE)
FOR CON_VALUE IN ([500],[300],[100],[30],[10],[3],[1],[0.3],[0.1],[0.03],[0.01])
)as PivotResult

" it the



Homero Rivera 27-Sep-15 0:30am    
What is the query to get what you're showing?
And, d you want to add up the values in the column? Make an average of them?
Member 11819086 27-Sep-15 4:44am    
COMP 500 300 100 30 10 3
7977797 19.67 -3.99 -7.92 -27.3 -145.2 -86.26

7977797 17.68 -7.68 -7.70 -33.07 -40.45 -58.82



the following "
with PivotData as
(SELECT TOP 1000 [WELLPOSITION]
,[COMPOUND_NAME]
,[CON_VALUE]
,[VALUE]
,[DATA_TYPE]
,[REPLICATES]
,[CONCENTRATION]
,[ASSAY_TYPE]
,[PLATE_ID]
,[Expr1]
FROM [AFileStorageDB].[dbo].[View_1] where DATA_TYPE='% Inhibition')

SELECT [COMPOUND_NAME],[500],[300],[100],[30],[10],[3],[1],[0.3],[0.1],[0.03],[0.01] from PivotData
PIVOT
(sum(VALUE)
FOR CON_VALUE IN ([500],[300],[100],[30],[10],[3],[1],[0.3],[0.1],[0.03],[0.01])
)as PivotResult

" it the

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900