Showing posts with label categories. Show all posts
Showing posts with label categories. Show all posts

Wednesday, March 21, 2012

need some help with my sql query

I'm still learning this stuff and I'm a bit confused. I have 3 tables: products, categories and subcategories. the products table has the foreign key for subcategories and the subcategories table has the foreign key for categories. I want to return a table that has the ProductID, SubCategoryID and CategoryID. I can't seem to fiqure out how to get the categoryID to the results table. I'm not sure if I'm supposed to use joins or subqueries to get the categoryID. All I have so far is this:


sql="SELECT Products.ProductID, Products.SubCategoryID FROM Products"

any help would be appreciated.I've come up with the following, i'm not sure if this is the correct way to do it, but it seems to work. I ran it through SQL Query Analyzer and it appears to give the results that i was expecting.


sql="SELECT Products.ProductID, Products.SubCategoryID, (SELECT CategoryID FROM SubCategories WHERE SubCategoryID = Products.SubCategoryID) as CategoryID
FROM Products";

If there is another/better/correct way to do this please let me know. Thanks.|||Another way to do it, which might be more efficient, is:


sql="SELECT Products.ProductID, Products.SubCategoryID, SubCategories.CategoryID FROM Products LEFT OUTER JOIN SubCategories ON Products.SubCategoryID = SubCategories.SubCategoryID";

Terri|||Very good, thanks. That is exactly what I was looking for.

Saturday, February 25, 2012

need help!!! how to fix pie slices in SQL Reporting Services?

would it be possible to have a uniform color for pie slices..
i mean if im going to made 3 charts with the same categories, it should have uniform color....

For example:
Chart1
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart2
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart3
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

So then, how can i pick color for pie slices in Excel and SQL Reporting Services? I need it ASAP!!! Thanks in advance :)

Please check the following article and sample: http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx

One part of the article describes how to define and use a custom color palette (this is what you are looking for). In your case, you would just make all the pie charts call the same function to get the color values.

Alternatively (but this is more work and less efficient), you could use an IIF function call on every datapoint to dynamically determine the colors. E.g. =iif(Fields!Region.Value = "America", "Green", iif(Fields!Region.Value = "India", "Blue", .... ))

-- Robert|||

How do i set the color of the datapoint in a pie chart.

Regards,

Karen

|||

I got that to work but i have one problem if my values contain

40%,30%, 30% the color repeats for the second 30% and 30% how can i get a different color for each of the 30%.

Any help will be appreciated.

Regards

Karen

need help!!! how to fix pie slices in SQL Reporting Services?

would it be possible to have a uniform color for pie slices..
i mean if im going to made 3 charts with the same categories, it should have uniform color....

For example:
Chart1
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart2
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart3
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

So then, how can i pick color for pie slices in Excel and SQL Reporting Services? I need it ASAP!!! Thanks in advance :)

Please check the following article and sample: http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx

One part of the article describes how to define and use a custom color palette (this is what you are looking for). In your case, you would just make all the pie charts call the same function to get the color values.

Alternatively (but this is more work and less efficient), you could use an IIF function call on every datapoint to dynamically determine the colors. E.g. =iif(Fields!Region.Value = "America", "Green", iif(Fields!Region.Value = "India", "Blue", .... ))

-- Robert|||

How do i set the color of the datapoint in a pie chart.

Regards,

Karen

|||

I got that to work but i have one problem if my values contain

40%,30%, 30% the color repeats for the second 30% and 30% how can i get a different color for each of the 30%.

Any help will be appreciated.

Regards

Karen

need help!!! how to fix pie slices in SQL Reporting Services?

would it be possible to have a uniform color for pie slices..
i mean if im going to made 3 charts with the same categories, it should have uniform color....

For example:
Chart1
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart2
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart3
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

So then, how can i pick color for pie slices in Excel and SQL Reporting Services? I need it ASAP!!! Thanks in advance :)

Please check the following article and sample: http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx

One part of the article describes how to define and use a custom color palette (this is what you are looking for). In your case, you would just make all the pie charts call the same function to get the color values.

Alternatively (but this is more work and less efficient), you could use an IIF function call on every datapoint to dynamically determine the colors. E.g. =iif(Fields!Region.Value = "America", "Green", iif(Fields!Region.Value = "India", "Blue", .... ))

-- Robert|||

How do i set the color of the datapoint in a pie chart.

Regards,

Karen

|||

I got that to work but i have one problem if my values contain

40%,30%, 30% the color repeats for the second 30% and 30% how can i get a different color for each of the 30%.

Any help will be appreciated.

Regards

Karen

Need Help! [Urgent]

would it be possible to have a uniform color for pie slices in SQL Reporting Services??
i mean if im going to made 3 charts with the same categories, it should have uniform color...

For example:
Chart1
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart2
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

Chart3
+America -- Green
+Philippines -- Red
+India -- Blue
+Japan -- Pink

So then, how can i pick color for pie slices in Excel and SQL Reporting Services?? I really need your help ASAP!!! Thanks

Hello,
According to the tests I've made, I've discovered that if the resultare sorted in the same order on the different charts, the slices are inthe same color : So, my answer would be : ORDER BY ;)