1

i've tried searching for a solution but to no avail.

i've created a pie chart in my content page based on a master page (used twitter bootstrap) and the chart is placed in a asp:content area.

my problem is the following, the pie chart is supposed to display the count of null records vs not null records within a single column and i kinda managed to do so:

http://www7.pic-upload.de/12.11.13/yj6phlzplbgu.png

however, as you might have noticed the series that feeds the chart has only 1 column with the 2 values i wanna use, the current sql is as follows, notice the union operator that i use and perhaps it's not the correct one:

SELECT COUNT (*) from [DB_teste].[dbo].[prd] 
where prd_nome is not null 
UNION SELECT COUNT (*) FROM [DB_teste].[dbo].[prd] WHERE prd_nome IS NULL

the output is

http://www7.pic-upload.de/12.11.13/ghxczr11pmlf.png

how do i change the legend from values to words, like "5" to "null values"? do i need to change the sql to address the fact that i only have 1 column?

any help would be much appreciated

user2983177
  • 201
  • 2
  • 6
  • 18

1 Answers1

0

Try doing something like this as your SQL:

SELECT 'NOT NULL VALUES' as Label, COUNT (*) as Result from [DB_teste].[dbo].[prd] where prd_nome is not null 
UNION 
SELECT 'NULL VALUES', COUNT (*) FROM [DB_teste].[dbo].[prd] WHERE prd_nome IS NULL

and feed the result to the chart.

Yuriy Galanter
  • 38,833
  • 15
  • 69
  • 136