Advertisement

06.16.2008 at 03:20PM PDT, ID: 23489820
[x]
Attachment Details

SQL statement (left join) not working as expected

Asked by UniqueData in Microsoft Access Database

Tags: Microsoft, Access, 2000

I have a table called luDocumentTypes which has Insurance and License document types.  I have another table called tblContractorDocuments.

Currently there are 4 type of Insurance related document types in luDocumentTypes and 3 License related document types.

I need a query that will return all insurance types for each contractorID.  I thought that was an easy Left Join (show all luDocumentTypes) but that's not working.  I have attached the sql statement I tried.

I am needing
Type 1        Contractor 1       DocType 1         expires 3//1/08
Type 2       Contractor 1       DocType 2           null
Type 3       Contractor 1      DocType 3            expires 5/1/08
Type 4      Contractor 1      DocType 4            null

Type 1      Contractor 2        DocType 1        null
Type 2    Contractor 2          DocType 2        expires 8/1/08
etc...Start Free Trial
1:
2:
3:
4:
SELECT tblContractorDocuments.ContractorID, luDocumentTypes.DocumentTypeID, luDocumentTypes.DocumentType, tblContractorDocuments.DocumentNumber, tblContractorDocuments.ExpireDate
FROM luDocumentTypes LEFT JOIN tblContractorDocuments ON luDocumentTypes.DocumentTypeID = tblContractorDocuments.DocumentTypeID
WHERE (((luDocumentTypes.IsInsurance)=True))
ORDER BY tblContractorDocuments.ContractorID, luDocumentTypes.DocumentType;
[+][-]06.16.2008 at 03:56PM PDT, ID: 21798269

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.16.2008 at 04:08PM PDT, ID: 21798341

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Access Database
Tags: Microsoft, Access, 2000
Sign Up Now!
Solution Provided By: UniqueData
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628