cancel
Showing results for 
Search instead for 
Did you mean: 

SQL query to provide a list of distinct keyword values (ID) associated with documents in a specific doc type group

Pam_Thomas
Star Contributor
Star Contributor

Would someone have a query that will provide the distinct IDs (primary keyword) with their First Name and Last Name keywords associated with all the documents in a specific Doc Type Group or associated with the doc types tied to a doc type group? I only need the ID listed one time regardless of how many doc types or documents have the keyword. I've tried a few queries from Community posts that were close to what I need, but I don't think it's quite giving me the distinct ID value because I'm seeing duplicates or I get values that do not have documents in the system. Would someone with more knowledge be able to assist or point me to another question previously asked in Community?

 

SELECT distinct (K1.keyvaluechar) AS 'ID',
K2.keyvaluechar AS 'First Name',
K3.keyvaluechar AS 'Last Name'
FROM hsi.itemdata i
LEFT OUTER JOIN hsi. keyitem100 K1 ON i.itemnum = K1.itemnum
LEFT OUTER JOIN hsi. keyitem101 K2 ON i.itemnum = K2.itemnum
LEFT OUTER JOIN hsi. keyitem102 K3 ON i.itemnum = K3.itemnum
where (i.itemtypegroupnum = '99')
and (i.status <> '16')
ORDER BY k1.keyvaluechar

 

Thank you!

1 REPLY 1

aboucher
Community Manager
Community Manager

Hi @Pam Thomas,

 

If another community member does not have a sample SQL query to share with you for this application, you can reach out for a Services engagement through your account manager. 

 

Thanks,

~Alan