I'm trying to setup a SQL query with a Where clause that have an input from the user but I still want the user to be able to select all values underneath a column if they want or a specific one. My example query looks as follows.
Select (value) from (table) where (columname) = (inputfromuser)
I don't know what to put as the input from the user if they want to see all the values contained in the table without having to choose a specific value from within the column but still have the option available.
One way to accomplish this would be to setup a SQL Query Service with an input parameter (in the example below named whereClause):
Not exactly understanding 100% what you are describing I should do.
Is there anyway I can put on if statement in the query such as
if [[Shift]] = '' then
DECLARE Shiftinput = "and Shift = [[Shift]]"
DECLARE Shiftinput = ""
basically stating if the user has put a value into the input for "Shift" then add the where clause on to the end of the query designated by the variable "Shiftinput" otherwise don't add the where clause on the end of the query by having the variable "Shiftinput" which is at the end of the query statement to be equal to nothing?