0

我的查询通过 jira 问题提取错误项目列表(特定于 jira 的组件),我需要找出如何在此查询中输入多个 pkey,单个 pkey 工作正常,但是当我声明多个 pkey 时它会引发错误消息.

在下面的查询中,abc-123 是一个 jira bug id,子查询找到组件名称,第二个子查询将获取项目名称,其余查询将提取与组件关联的错误列表,我想输入'def-456','jdk -985' 在 'abc-123' 旁边,我尝试设置新变量但它不起作用,有人可以帮忙吗

$

set @pkey := 'abc-123';

select jiraissue.*, co.* 
from jiraissue,project,issuetype,nodeassociation,component,
customfieldvalue cv
,customfieldoption co 
where 
component.cname = (SELECT component.cname
FROM nodeassociation, component, jiraissue
WHERE component.ID = nodeassociation.SINK_NODE_ID
AND jiraissue.id = nodeassociation.SOURCE_NODE_ID
AND nodeassociation.ASSOCIATION_TYPE = 'IssueComponent'
AND pkey = @pkey) and 
project.pkey = (SELECT substring_index(jiraissue.pkey,'-',1) as project_name
FROM nodeassociation, component, jiraissue
WHERE component.ID = nodeassociation.SINK_NODE_ID
AND jiraissue.id = nodeassociation.SOURCE_NODE_ID
AND nodeassociation.ASSOCIATION_TYPE = 'IssueComponent'
AND pkey = @pkey) and 
issuetype.pname = 'Bug' and
jiraissue.project = project.id and 
jiraissue.issuetype = issuetype.id and 
nodeassociation.association_type = 'IssueComponent' and
nodeassociation.source_node_entity = 'Issue'  and
nodeassociation.source_node_id = jiraissue.id  and
nodeassociation.sink_node_entity = 'Component'  and
nodeassociation.sink_node_id = component.id 
and jiraissue.id = cv.issue
and cv.stringvalue = co.id
and cv.customfield = 10020;
4

1 回答 1

1

尝试更换

AND pkey = @pkey

有了这个:

AND pkey in (@pkey, @pkey1, @pkey2)

然后在顶部:

set @pkey := 'abc-123', @pkey1 := 'def-456', @pkey2 = 'ghi-789'
于 2012-05-14T04:08:25.780 回答