Query criteria from two tables in main connection
I need to be able to generate a query that uses conditional criteria from two different tables (one a subsidiary of the other).
I have two tables :
Project Details
Project Id
Project Description etc
Area Id
Contact Details
Contact Id
Project Id
Contact Name etc
I need to be able to be able to query on any of the combined fields .
Example Queries :
1) List all Projects (plus the Contact Details for the Project) where the Contact Id is 5.
2) List all projects that have an area Id of 5 and where the Contact Id is 2.
And so on â¦â¦â¦â¦â¦â¦â¦..
I am using Infopath 2003 and I can not achieve this simple requirement.
Nor can I find any examples in books or on the net.
I have tried to do it through the form handling, through code behind buttons etc â¦â¦â¦â¦
Can someone please provide some expertise in this area?
I have created a main connection that has the two tables related together.
If I create the query fields from the main connection, then the query will successfully create the query on the main table (Project Details) and the Contact Details Query conditions will apply to the subsiduary table Contact Details.
I want to return back project details for all entries that have contact id 5 (and maybe some additional conditions on the main table).
If I just enter contactId 5 as the criteria, I get the entire main table returned and then just the contact ids that have 5.
I want the query to find the Project Details where there is a related contact id of 5.
SQL:
Select * from ProjectDetails where ProjectId in (select ProjectID from ContactTable where ContactId = 5)
Naturally the 5 comes from the form control value.
|