I have a month drop down list.
In my dataset I have the code which generates month name for all months.
In my parameter list I want the functionality of the user able to select 'All' as Month name.
How can I achieve this in the query and parameter.
Code for month generation is as.
SELECT DISTINCTSUBSTRING(DATENAME(mm, T1.OPEN_TIME), 0,4) AS Month,
DATENAME(mm, T1.OPEN_TIME) AS MONTH_NAME_FULL,
DATEPART(mm, T1.OPEN_TIME) AS MONTH_NUM
FROM APPS237.Cats.dbo.Pd T1
Order By
DATEPART(mm, T1.OPEN_TIME)
Thanks,
Kiran.
You can use the UNION ALL clause to add the 'All' entry to the beginning of the table generated by your query. For example,
SELECT DISTINCT SUBSTRING(DATENAME(mm, T1.OPEN_TIME), 0,4) AS Month,
DATENAME(mm, T1.OPEN_TIME) AS MONTH_NAME_FULL,
DATEPART(mm, T1.OPEN_TIME) AS MONTH_NUM
FROM APPS237.Cats.dbo.Pd T1
UNION ALL
SELECT 'All', 'All', 0
Order By MONTH_NUM
Ian
No comments:
Post a Comment