I'm actually creating a report in SQL Report Builder 3.0, so I am not even sure if this question I allowed in here or not, but I figured I would give it a shot. I am very new at SQL so bear with me .............
I have a database that lists data related to several different police departments, but they are identified by a 4-digit code rather than by their name. For most agencies that is no problem, but some have more than one code, and I want the user to be able to filter the reports by a "user friendly" agency name rather than by the code. In the example below, I have the report builder filter parameter set to one specific agency and code, and it works fine.
Screen Shot 11-27-17 at 06.43 PM.JPG
Obviously I am filtering this report to a specific agency whose code in the database table is "0210." This works perfectly, but unfortunately this particular agency actually has records with two "agency codes." Some records are 0210 and some are 0211. As such, I want to write an expression that basically says Berwyn Heights PD = 0210 Or 0211, but that apparently is not the correct way to write it because it fails. (I also tried it as Berwyn Heights PD = "0210" Or "0211", along with Berwyn Heights PD = "0210" .or. "0211", but those didn't work either.)
Screen Shot 11-27-17 at 06.57 PM.JPG
I've searched the internet until my fingers are sore, and I can't find an answer, so I am wondering if anyone here knows the correct way to write this SQL expression?
Thanks,
Rich
I have a database that lists data related to several different police departments, but they are identified by a 4-digit code rather than by their name. For most agencies that is no problem, but some have more than one code, and I want the user to be able to filter the reports by a "user friendly" agency name rather than by the code. In the example below, I have the report builder filter parameter set to one specific agency and code, and it works fine.
Screen Shot 11-27-17 at 06.43 PM.JPG
Obviously I am filtering this report to a specific agency whose code in the database table is "0210." This works perfectly, but unfortunately this particular agency actually has records with two "agency codes." Some records are 0210 and some are 0211. As such, I want to write an expression that basically says Berwyn Heights PD = 0210 Or 0211, but that apparently is not the correct way to write it because it fails. (I also tried it as Berwyn Heights PD = "0210" Or "0211", along with Berwyn Heights PD = "0210" .or. "0211", but those didn't work either.)
Screen Shot 11-27-17 at 06.57 PM.JPG
I've searched the internet until my fingers are sore, and I can't find an answer, so I am wondering if anyone here knows the correct way to write this SQL expression?
Thanks,
Rich
Comment