J
JP SIngh
Hi All
I run a query which gets data from two tables.
I store in MainContracts Table
ContractId
InitiatedBy
In the ContractDependents table I store
ContractId
EmpName
In the empprofile table I store
EmpName
FirstName
LastName
Email
For each contract we have multiple contract dependents.
What I want to do is to write a query to pull the email address of the
initator of the record and the email of all the contract dependents to allow
me to send an email to all of them.
At present I doing this.(just the logic not the actual code)
Get contract initiators email
SELECT Contracts.Id, Contracts.initiatedby, EMPProfile.EmpName,
EMPProfile.email
FROM Contracts LEFT JOIN EMPProfile ON Contracts.initiatedby =
EMPProfile.EmpName
WHERE (((Contracts.Id)=54207));
Send email to the contract initiator
Get the list of all contract dependents and thier email addresses
SELECT Contractdependents.contractnumber, Contractdependents.EMPName,
EMPProfile.EmpName, EMPProfile.email
FROM Contractdependents LEFT JOIN EMPProfile ON Contractdependents.EMPName =
EMPProfile.EmpName
WHERE (((Contractdependents.contractnumber)=54207));
Loop through the above recordset and send email to each dependent.
I feel opening two recordsets are slow and not efficient.
Am I correct? is there a better way of doing this.
Regards
Jas
I run a query which gets data from two tables.
I store in MainContracts Table
ContractId
InitiatedBy
In the ContractDependents table I store
ContractId
EmpName
In the empprofile table I store
EmpName
FirstName
LastName
For each contract we have multiple contract dependents.
What I want to do is to write a query to pull the email address of the
initator of the record and the email of all the contract dependents to allow
me to send an email to all of them.
At present I doing this.(just the logic not the actual code)
Get contract initiators email
SELECT Contracts.Id, Contracts.initiatedby, EMPProfile.EmpName,
EMPProfile.email
FROM Contracts LEFT JOIN EMPProfile ON Contracts.initiatedby =
EMPProfile.EmpName
WHERE (((Contracts.Id)=54207));
Send email to the contract initiator
Get the list of all contract dependents and thier email addresses
SELECT Contractdependents.contractnumber, Contractdependents.EMPName,
EMPProfile.EmpName, EMPProfile.email
FROM Contractdependents LEFT JOIN EMPProfile ON Contractdependents.EMPName =
EMPProfile.EmpName
WHERE (((Contractdependents.contractnumber)=54207));
Loop through the above recordset and send email to each dependent.
I feel opening two recordsets are slow and not efficient.
Am I correct? is there a better way of doing this.
Regards
Jas