简体   繁体   中英

How to remove multiple values from SSRS parameter drop down

I have a report where I want to add a parameter as a drop down. The database has more than 13,000 records and the parameter I want to add is of the building names in the record. There are around 6 different building names. When I add the parameter by taking Values from a query and passing the building name as the value, the drop down repeats the 6 building names of all 13,000 records rather than just the 6 building names.

Is there a way where I can filter it to show the 6 building names and then show the records related to that building name?

SELECT  new_studentid, new_studentinformationid, new_firstname, new_lastname, new_building, new_busnumber, new_grade, new_primaryhomeroom,documentbody FROM  StudentInformation WHERE(new_building = @new_building) AND (new_primaryhomeroom = @new_primaryhomeroom)

You will need to make a query just for the parameter drop-down. It should probably be something like this:

SELECT  DISTINCT new_building
FROM  StudentInformation 

Then for the HomeRoom parameter, use this query:

SELECT  DISTINCT new_primaryhomeroom
FROM  StudentInformation 
WHERE(new_building= @new_building)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM