September 4, 2012 at 3:29 pm
This is such a newbie question, but I haven't been able to figure it out. I have a databar that only appears on a single row. I will have to hardcode in my select statement what to evaluate it against. I thought I could do something like this:
SELECT value AS size
FROM table
WHERE condition = 'yes'
UNION ALL
SELECT CAST('100' AS Numeric)
The results would be:
Size
23
100
But when I put the column "size" as my value, nothing happens - the whole bar is shaded. Would someone mind pointing me in the right direction?
September 5, 2012 at 8:33 am
does this script work in a query window? i could be wrong but i think you might have to put an "as Size" after the cast statement.
September 5, 2012 at 9:24 am
Andy Gerard (9/5/2012)
does this script work in a query window? i could be wrong but i think you might have to put an "as Size" after the cast statement.
No, the two select statements are in a union. The first select statement will control the column names. If this was not the behavior then it would allow for the same column to have two different names in the same query.
Here is proof:
select 1 as MyColName union all
select 2 as SomeOther
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 5, 2012 at 9:45 am
right, right... sorry for the bad info.
September 5, 2012 at 10:07 am
Andy Gerard (9/5/2012)
right, right... sorry for the bad info.
No worries.
Now to try to help the OP...I don't understand what the issue is.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 5, 2012 at 10:27 am
if i understand correctly, the OP is looking to have the values returned in the query used as Y-axis values for a bar graph. the query should return two values, (23, 100) and the graph should have 2 points on the x axis with these y axis values, but it's not working.
September 5, 2012 at 10:56 am
You got it. Basically, I'm not sure how to structure the query or the bar graph to make it move around. For example, I have a class that has 100 available seats but only 25 of those seats are taken. So I want to move the bar 25%. The class size (e.g. 100) will have to be hardcoded, but the seats take (e.g. 25) will come from a query. It's a newbie question, but I haven't dealt with charts much before.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply