sql中添加参数方法
使用reporting service开发报表,mysql数据源时问题。
需要在sql中添加几个参数,请大神协助:
select p.name as projectname,
b.id,
g.name categoryname,
u.realname,
b.summary,
t.description,
c.depart,
c.owner,
c.descrip,
(case b.status
when '10' then
'新建'
when '40' then
'已确认'
when '50' then
'已分派'
when '80' then
'已解决'
when '85' then
'已验收'
when '90' then
'已关闭'
else
'其他'
end) as status,
FROM_UNIXTIME(b.date_submitted) as starttime,
FROM_UNIXTIME(b.last_updated) as endtime
from mantis_bug_table b,
mantis_bug_text_table t,
mantis_project_table p,
mantis_category_table g,
mantis_user_table u,
(select a1.bug_id, a1.depart, a2.owner, a3.descrip
from (select bug_id, value as depart
from mantis_custom_field_string_table
where field_id = '1') a1
LEFT JOIN (select bug_id, value as owner
from mantis_custom_field_string_table
where field_id = '4') a2
on a2.bug_id = a1.bug_id
LEFT JOIN (select bug_id, value as descrip
from mantis_custom_field_string_table
where field_id = '7') a3
on a3.bug_id = a2.bug_id) c
where b.bug_text_id = t.id
and b.project_id = p.id
and b.id = c.bug_id
and b.category_id = g.id
and b.reporter_id = u.id
AND p.name like @proname || '%'
AND b.status like @status || '%'
试过了@ + 参数名;$ +参数名。都没用。
哪位知道的帮忙看下。