In an an existing SSRS 2008 r2 report, I want to have a parameter called @hair where the user can see if the customer purchased one of the following items:
1. hair spray,
2. hair shampoo,
3. Hair color,
4. hair conditioner, or
5. No hair product purchased.
The table is called inventory and the values for the field called hairproduct are
1. hair spray = 'HR',
2. hair shampoo = 'HS',
3. hair color = 'HC',
4. Hair conditionier = 'HD',
5. If hair product is not purchased hairproduct value is null. This is due to
the inventory table contains columns like hairproduct, eyeproduct, faceproduct. If a
particular product is purchased, the column will contain a value. If a customer purchases all 4 hair products and 3 eyeproducts, and 9 faceproducts, the inventory table will contain 16 columns for a particualr customer.
In the parameter window, I can use the following to have the correct values be displayed in the selection window:
SELECT DISTINCT IsNull(inventory.hairproduct,'') as hairid,
WHEN 'HR' then 'hair spray'
WHEN 'HS' then 'hair shampoo'
WHEN 'HC' then 'Hair color'
WHEN 'HC' then 'hair conditioner'
WHEN '' then 'No hair product purchased'
**Note the @hairproduct parameter allows blank values and allows multiple values.
However in the main query for the ssrs 2008 r2 report, I am not certain how I would change the following statement to select 'No hair product purchased'.
The current select statement looks like the following:
from inventory where customer_id = @customerid
hairproduct in (@hairproduct).
Basically I need to change the main query, dataset that matches the parameter @hairproduct, or possibly add a new parameter that means 'No hair product purchased' to report on the customer that has one or more hair products purchased or none.
Thus can you tell me and/or show me sql that will solve my problem?