0

私のクエリはjiraの問題(jiraのコンポーネントに固有)ごとにバグアイテムのリストを取得します。このクエリに複数のpkeyを入力する方法を見つける必要があります。単一のpkeyは正常に機能しますが、複数のpkeyを宣言するとエラーメッセージがスローされます。 。

次のクエリでは、abc-123はjiraバグIDであり、サブクエリはコンポーネント名を検出し、2番目のサブクエリはプロジェクト名をフェッチします。残りのクエリはコンポーネントに関連するバグのリストをプルします。「def-456」、「jdk」と入力します。 -'abc-123'の横にある985'、新しい変数を設定しようとしましたが、機能しませんでした。誰か助けてください

$

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 に答える