跳至主要內容

若不选择则默认所有

五六零网校小于 1 分钟

代码

 WHERE  (T3.name='[%1]' or '[%1]'='') 

应用示例

SELECT
    T0.[ClgCode],
    T4.[U_NAME] AS '人员',
    T1.[Name] AS '部门',
    T2.[Name] AS '主题',
    T0.[Recontact],
    T0.[Details] AS '活动主题',
    T0.[Notes] AS '活动内容',
    T3.[name]
FROM
    OCLG T0
INNER JOIN OCLT T1 ON T0.[CntctType] = T1.[Code]
INNER JOIN OCLS T2 ON T0.[CntctSbjct] = T2.[Code]
INNER JOIN OCLA T3 ON T0.[status] = T3.[statusID]
INNER JOIN OUSR T4 ON T0.[AttendUser] = T4.[USERID]
WHERE
    T1.[Name] = [ % 0]
AND (T3.name = '[%1]' OR '[%1]' = '')
ORDER BY
    T0.[ClgCode] DESC