我有一个有邮寄地址的年轻照顾者数据库。有时年轻人有第二个地址,这取决于他们与谁住在一起。有时需要将信息发送到地址 1 或地址 2 或两个地址;我使用组合框来告诉我需要使用哪个地址,即地址 1、地址 2 或两者。
如何编写查询?这是目前的查询,我只需要它自动插入正确的地址!
SELECT tblYoungCareerDetails.Flagged
, tblYoungCarersDetails.FirstName
, tblYoungCarersDetails.LastName
, tblYoungCarersDetails.Address1
, tblYoungCarersDetails.Address2
, tblYoungCarersDetails.Address3
, tblGeographicalArea.QuarterStarted
, tblYoungCarersDetails.[2ndAddress1]
, tblYoungCarersDetails.[2ndAddress2]
, tblYoungCarersDetails.[2ndAddress3]
, tblMailOutList
, tblYoungCarersDetails.UseAddressLabel
FROM (tblYoungCarersDetails
INNER JOIN tblMailOutDetails
ON tblYoungCarersDetails.YoungCarersID = tblMailOutDetails.YoungCarersID)
INNER JOIN tblGeographicalArea
ON (tblMailOutDetails.YoungCarersID)
AND (tblMailOutDetails.YoungCarersID = tblGeographicalArea.YoungCarersID)
WHERE (((tblMailOutDetails.MailOutList)=Yes));
这使我所有年轻职业的邮寄详细信息都得到了一定程度的服务,我现在如何确保他们将信息发送到正确的地址?