Different where clause based on SSRS parameter I have an SSRS report where a parameter can take 3 values. The select query is the same in all cases but the where clause needs to check different date fields based on the parameter value. Is this possible in the same query?

Query:

SELECT OrdNO, OrdType, customer, SalesRep, FundDate, DisbursementDate, Branch, SalesPrice 
FROM Orders

-- Case @ReportType=1, use FundDate
   where (FundDate &gt;= @FromDate and FundDate &lt;= @ToDate)

-- Case @ReportType=2, use DisbursmentDate
   Where (DisbursementDate &gt;= @FromDate and DisbursementDate &lt;= @ToDate)

-- Case @ReportType=3, use both dates
   where (FundDate &gt;= @FromDate and FundDate &lt;= @ToDate) or (DisbursementDate &gt;= @FromDate and DisbursementDate &lt;= @ToDate)
Yes, something like the below.

SELECT * 
FROM DataTable
WHERE (@SearchField = 'CreateDate' AND CreateDate BETWEEN @StartDate AND @EndDate)
OR (@SearchField = 'ModifyDate' AND ModifyDate BETWEEN @StartDate AND @EndDate)


Or, to use the example WHERE clauses you specified, how about the below?

SELECT *
FROM DataTable
WHERE (
        @ReportType = 1
        AND FundDatte &gt;= @FromDate
        AND FunDate &lt;= @ToDate
        )
    OR (
        @ReportType = 2
        AND DisbursementDate &gt;= @FromDate
        AND DisbursementDate &lt;= @ToDate
        )
    OR (
        @ReportType = 3
        AND (
            (
                FundDatte &gt;= @FromDate
                AND FunDate &lt;= @ToDate
                )
            AND (
                DisbursementDate &gt;= @FromDate
                AND DisbursementDate &lt;= @ToDate
                )
            )
        )