G
Guest
Posted - 11/12/2003 : 02:22:40
-------------------------------------------------------------------------------
Im trying to use this statement
SELECT Distinct D.DocumentID,D.FileName,D.Title,D.ShortDescription,D.DatePublished,DTR.DocumentID,DT.DocumentType,DT.ThumbNailImage from Documents D, DocumentSubjectAreas DSA, DocumentSubjectAreasREL DSAR, DocumentTypes DT, DocumentTypesRel DTR WHERE Instr(Lcase(DSA.SubjectArea), 'new') > 0 AND D.DocumentID=DSAR.DocumentID And DSAR.SubjectAreaID=DSA.SubjectAreaID And D.DocumentID=DTR.DocumentID AND DT.DocumentTypeID=DTR.DocumentTypeID Order By D.DatePublished des
The problem is that it doesnt return only distinct values for DocumentID. The table Documents, contains the DocumentID primary key column. The table DocumentTypesREL holds the relation between document types and documents. Therefore, a document may have multiple document types and therefore the DocumentID key will be found in DocumentTypesRel multiple times, however, I need to only select distinct DocumentID's from DocumentTypesRel. I cant seem to figure out why my statement isnt doing this. Can anyone help
Thanks, lanc
-------------------------------------------------------------------------------
Im trying to use this statement
SELECT Distinct D.DocumentID,D.FileName,D.Title,D.ShortDescription,D.DatePublished,DTR.DocumentID,DT.DocumentType,DT.ThumbNailImage from Documents D, DocumentSubjectAreas DSA, DocumentSubjectAreasREL DSAR, DocumentTypes DT, DocumentTypesRel DTR WHERE Instr(Lcase(DSA.SubjectArea), 'new') > 0 AND D.DocumentID=DSAR.DocumentID And DSAR.SubjectAreaID=DSA.SubjectAreaID And D.DocumentID=DTR.DocumentID AND DT.DocumentTypeID=DTR.DocumentTypeID Order By D.DatePublished des
The problem is that it doesnt return only distinct values for DocumentID. The table Documents, contains the DocumentID primary key column. The table DocumentTypesREL holds the relation between document types and documents. Therefore, a document may have multiple document types and therefore the DocumentID key will be found in DocumentTypesRel multiple times, however, I need to only select distinct DocumentID's from DocumentTypesRel. I cant seem to figure out why my statement isnt doing this. Can anyone help
Thanks, lanc