Access database

Discussion in 'Databases' started by Kain, Jul 13, 2007.

  1. #1
    I have 2 tables in an access database.

    Each have fields called URL and Category. The second table has a lot of incorrect or blank entries for the category field.

    Does anyone know how to get Access to loop through each entry and overwrite the entries for category in table 2 replacing it for the value for table one where the url is the same in each category?

    Thanks
     
    Kain, Jul 13, 2007 IP
  2. Synch

    Synch Peon

    Messages:
    76
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    update table2
    inner join table2 on table1.URL=table2.URL
    set category=table1.category

    I don't know if this is exact but it should get you started
     
    Synch, Jul 13, 2007 IP
  3. Kain

    Kain Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, do I just copy that query into access replacing table1 and table2 with the actual table names?
     
    Kain, Jul 13, 2007 IP
  4. Synch

    Synch Peon

    Messages:
    76
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yeah, i dont have access though so im not 100% sure that it would run, it would work on sql server.
     
    Synch, Jul 14, 2007 IP
  5. Kain

    Kain Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks for that.

    I tried your query but got an error saying "Syntax error in join operation"

    Here is the query I used:

    update Sites
    INNER JOIN Sites on Listings.URL=Sites.URL
    set Sites.Cat=Listings.Cat

    The tables are sites and listings and I want to set the field cat on sites to match the field cat on listings where the urls are the same in both fields.

    Thanks
     
    Kain, Aug 3, 2007 IP