select s.prodid from tbl_PRD_Skus s with (nolock) where s.fsl_tableCode = and s.ownerId = and s.skuid = select fileid, contentid, docDescription, doctitle, docPath, fileext, fileSize, sortrank, uploaddate, 'REP' as docType from qmd_repositoryContents where doctitle not like 'BARCODE CODE128_UCC' union select docid as fileid, contentid, docDescription, doctitle, docPath, fileext, fileSize, sortrank, uploaddate, 'DOC' as docType from qmd_getLinkedDocuments union select docid as fileid, contentId, docdescription, doctitle, docpath, fileExt, fileSize, sortRank, uploadDate, 'INH' as docType from qmd_getInheritedDocuments order by docTitle