Results 1 to 3 of 3

Thread: SQL Syntax Help

  1. #1
    Join Date
    Aug 2003
    Posts
    106

    Unanswered: SQL Syntax Help

    Hi

    Can anyone help me with the syntax here please??

    I have a table called 'Counties' and a table called 'ImportData'

    Both contain a field named 'County'

    'ImportData' has hundreds of records with duplicate values and 'Counties' has one of each county and an ID (Autonumber).

    I would like to create SQL to append any unmatched counties from 'ImportData' to 'Counties'

    Here is what i have so far:

    SELECT DISTINCTROW ImportArea.County FROM ImportArea LEFT JOIN Counties ON ImportArea.County = Counties.County GROUP BY ImportArea.County, Counties.County HAVING (((Counties.County) Is Null))

    This shows me one of each county that is not in 'Counties' . I just need an INTO statement i think but have got confused where to place it

    Thanks

    sugarflux

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    INSERT INTO Counties (County) SELECT ....

  3. #3
    Join Date
    Aug 2003
    Posts
    106
    I get an 'aggregate function' error when i do this??

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •