How to remove multiple values from SSRS parameter drop down - reporting-services

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)

Related

how to manipulate SSRS multiple values parameters in a dataset

i have a simple ssrs report in which i have one multiple values parameter.
I want to use the returned values to execute some queries on another table, but when i create the second dataset and i try to get the list of returned values i get ssrs error.
Example:
Multiple values parameter: #MyParam1
Anthony
Michael
Mary
I want to select for example only the values that starts with 'M' and populate with the filtered data another multiple values parameter called #MyParam2.
When i try to parse #MyParam1 in my dataset query i get the error because teh returned value is an array type. I read on some blogs that i can use the JOIN function , but how i can use directly in the Dataset TSQL code?
thanks a lot!
You could use the original table for the parameters and filter it by your selection for your main query.
SELECT FIRST_NAME, USER_LAST_NAME, USER_ID
INTO #TEMP_USERS
FROM USERS
WHERE FIRST_NAME IN (#MyParam1)
Then JOIN on the TEMP table to filter for the parameter selections and add your criteria.
JOIN #TEMP_USER U ON U.USER_ID = X.USER_ID AND U.FIRSTNAME LIKE ('M%')

how to count multiple row (separately)

i've been learning mysql since 2 weeks ago and then i have a problem how to count values in multiple rows. in other words , i want to make a new table look like this
!https://imgur.com/mw94aVT
from data like this
! https://imgur.com/undefined
currently i'm using this method
SELECT COUNT(id_rt)
FROM krt
WHERE id_rt = 87900;
and change the values (87900) manually until 100+ data
is there any option how to automatically show id_rt with count ?
Presumably, you are looking for GROUP BY:
SELECT id_rt, COUNT(*)
FROM krt
GROUP BY id_rt;

Filter query - editing results

In MS access, I have a query that i filter with a list of keywords through a second query. The second select query (which acts as a filter) takes the original (data) query and a keyword table and selects from the data query only the entries that match one of the keywords in the list.
I want to edit a field in the resulting query but access doesnt let me. From what i gather from google & Co. My issue might be caused by not having a relationships between the data query and the keyword table. What can i do to enable editing of the data ? If i were to create a relationship between the keyword table and the data query, how would i design it since 1 keyword does not correspond to one entry in the data query.
Edit: here is the SQL code
Select Sales.saleID, Sales.saleText1, Sales.saleText2, Sales.clientFirstName, Sales.clientLastName, Sales.clientOk
From Sales, Keywords
Where (((Sales.saleText1) Like Keywords!Keyword)) or (((Sales.saleText2) Like Keywords!Keyword));
This returns the correct data but then i cannot edit the clientOk field in the datasheet view (clientOk is a number field)
Thanks in advance for the help
Try something like this:
Select
Sales.saleID, Sales.saleText1, Sales.saleText2, Sales.clientFirstName, Sales.clientLastName, Sales.clientOk
From
Sales
Where
(Sales.saleText1 In (Select [Keyword] From Keywords))
or
(Sales.saleText2 In (Select [Keyword] From Keywords));

Updating several table columns based off a Select Query

So this is my Select Query called qryHoursSUM.
SELECT DAL.Project
, DAL.Unit
, DAL.Activity
, Sum(([EndTime]-[StartTime])*24) AS Hours
FROM DAL INNER JOIN UnitTbl
ON (DAL.Project=UnitTbl.Project) AND (UnitTbl.Unit=DAL.Unit)
GROUP BY DAL.Project, DAL.Unit, DAL.Activity;
I'm trying to get it to update to the corresponding *** Actual field and matching row in my Table called UnitTbl, which has the Project and Unit fields as a composite primary key. I cant seem to get it to work. I've first tried running a update query based on the select query but received an "Operation must use an updateable query", and found out that its not possible. I've made a make table query call qrySumHoursTbl to turn the qryHoursSUM into a table
SELECT qryHoursSUM.* INTO SumHoursTbl
FROM qryHoursSUM;
Then created an update query called qryUpdateUnitTbl to just update the 002 Actual field
UPDATE SumHoursTbl INNER JOIN UnitTbl
ON (SumHoursTbl.Unit = UnitTbl.Unit)
AND (SumHoursTbl.Project = UnitTbl.Project)
SET UnitTbl.[002 Actual] = [Hours]
WHERE (([Activity]="002 Drafting Submittals"));
Is it possible to have an update query to update multiple fields at once or would I have to make a update for each field i want to update?
Also, for some reason it only update the UnitTbl with whole numbers only, I need to have it show up to 2 decimal places. After working with so many copies, I completely forgot to change the field size to double. After changing that, its showing up to 2 decimal places
My end goal is to be able to let a user click on a button that shows a variance report of hours for each units Budgeted hours and Actual hours (which would be [*** Budget] - [*** Actual]) Any tips for things to consider along the way to get there is appreciated, I've trying to figure this out for a week now.

Access update query based on 2 field values in another table

I am trying to run an update query based on 2 fields in a seperate table. I know how to do it based on one field, add the two tables, create a join between the two related fields and run the update. However when I try and run it with two joins it says it cannot execute because it contains ambiquous joins. Here's a brief example of what I'm trying to achieve
Table 1 contains name, location and number of items.
Table 2 contains name, location and and empty field for the number of items.
When i try update table 2 with the information from table 1, with a join between the 2 name fields, it updates the same number of items for each different location.
UPDATE:
I've fixed it, I think I was linking the joins incorrectly.
Here's the finished SQL statement:
UPDATE Tbl_Hourly_Pick_Performance
LEFT JOIN Tbl_Temp_Count_Info
ON (Tbl_Hourly_Pick_Performance.[Sign On]=Tbl_Temp_Count_Info.[Picker ID])
AND (Tbl_Hourly_Pick_Performance.[Pick Floor]=Tbl_Temp_Count_Info.Floor)
SET Tbl_Hourly_Pick_Performance.[No of Stores] = Tbl_Temp_Count_Info.Count;