Newbie SQL append query problem

  • Thread starter Thread starter Larry Marshall
  • Start date Start date
L

Larry Marshall

I am lost. I have two tables, parent/child relationship:

Property Mailings
propkey PK Mailkey PK
. propkey FK
. MailDate

I need to do mailings at 30-day intervals, creating new records with
today's date. I cannot save the following append query, "Syntax error
in query expression:

'(Date() , (SELECT Property.propkey, max(mailings.maildate)
FROM Property LEFT JOIN Mailings ON
Property.PropKey=Mailings.PropKey
WHERE DateAdd("d",30,Mailings.MailDate)<Date() Or
[Mailings.MailDate] Is null
group by property.propkey);'


The query is:

INSERT INTO Mailings ( Mailings.MailDate, Mailings.propkey )
SELECT (Date() , (SELECT Property.propkey, max(mailings.maildate)
FROM Property LEFT JOIN Mailings ON
Property.PropKey=Mailings.PropKey
WHERE DateAdd("d",30,Mailings.MailDate)<Date() Or
[Mailings.MailDate] Is null
group by property.propkey);

TIA - lost in SQL
 
Hi,



Try:


SELECT MIN(Date()), ... GROUP BY ...

instead of


Date(), (SELECT ... GROUP BY ...)




Hoping it may help,
Vanderghast, Access MVP
 
Back
Top