SSRS:参数不过滤MySQL查询

时间:2018-04-05 16:56:29

标签: mysql reporting-services parameters mariadb

我的报告中有一个日期/时间参数:

enter image description here

但是当我运行查询时,我没有得到任何结果:

 SELECT HD_QUEUE.NAME as qname, HD_TICKET.ID, HD_TICKET.CREATED, HD_TICKET.TIME_CLOSED, CUSTOMER.FULL_NAME as custfullname, 
     HD_STATUS.NAME as statname, HD_TICKET.TITLE, left(ASSIGNEE.FULL_NAME, 40) as assignee, 
     HD_PRIORITY.NAME as pname, HD_CATEGORY.NAME as catname
    FROM  HD_TICKET 
     INNER JOIN HD_QUEUE
    ON HD_TICKET.HD_QUEUE_ID = HD_QUEUE.ID
    INNER JOIN USER CUSTOMER
    ON HD_TICKET.SUBMITTER_ID=CUSTOMER.ID
    INNER JOIN USER ASSIGNEE
    ON HD_TICKET.OWNER_ID=ASSIGNEE.ID 
     INNER JOIN HD_STATUS 
     ON (HD_TICKET.HD_STATUS_ID=HD_STATUS.ID) 
     AND (HD_TICKET.HD_QUEUE_ID=HD_STATUS.HD_QUEUE_ID)
    INNER JOIN HD_PRIORITY
    ON HD_TICKET.HD_PRIORITY_ID = HD_PRIORITY.ID
      and HD_TICKET.HD_QUEUE_ID = HD_PRIORITY.HD_QUEUE_ID
      INNER JOIN HD_CATEGORY
    ON HD_TICKET.HD_CATEGORY_ID = HD_CATEGORY.ID
    and HD_TICKET.HD_QUEUE_ID = HD_CATEGORY.HD_QUEUE_ID
    left join ASSET on ASSET.ID = HD_TICKET.ASSET_ID
    left join ASSET_DATA_6 on ASSET.ASSET_DATA_ID = ASSET_DATA_6.ID
    WHERE (HD_STATUS.NAME = 'Closed'
    AND HD_TICKET.TIME_CLOSED < @date_param);

我做错了什么?

1 个答案:

答案 0 :(得分:0)

MySQL不允许命名参数。使用 '?'而不是查询中的'@date_param'。

WHERE (HD_STATUS.NAME = 'Closed'
AND HD_TICKET.TIME_CLOSED < ?;

然后检查数据集属性并确保'?'与您的参数值相关联:

Parameter Name field is ? and Parameter Value field is the name of your parameter