Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append Query

Status
Not open for further replies.

Lenny46

Technical User
Jun 5, 2000
2
US
What would the SQL equivalent be to:<br><br>For every record in CONTACTS Table, create a new record (Append) in MAILINGS Table with the [ContactID] (from the CONTACTS Table) so that Mailings.ContactID=Contacts.ContactID plus make Mailings.MailDate=#5/15/00# and Mailings.MailType=&quot;NewsLetter&quot;<br><br>Note:<br>That's it!&nbsp;&nbsp;That's all I want to do but I have been stymied.&nbsp;&nbsp;Mailings only has three fields, ContactID, MailDate and MailType.&nbsp;&nbsp;So for every Contact, I want a new record in Mailings.<br><br>More Info.:<br>ContactID in CONTACTS Table is an AutoNumber Field so they are unique and the ContactID filed is in a one to many relationship with the ContactID field in MAILINGS Table.<br><br>ContactID in CONTACTS Table is NOT a Primary Key.&nbsp;&nbsp;It is indexed - NO Duplicates.<br><br>ContactID in MAILINGS Table is also indexed but Duplicates are allowed.<br><br>Would appreciate any assistance.&nbsp;&nbsp;I am probably leaving out one important step but I can't figure out what it is.<br>
 
INSERT INTO MAILINGS ( ContactID, MailDate, MailType )<br>SELECT Contacts.ContactID, #5/15/2000# AS Expr2, &quot;NewsLetter&quot; AS Expr1<br>FROM Contacts;<br><br>Here you go I just tested it, it works great.<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top