[thelist] More SQL conundrums....

rudy r937 at interlog.com
Mon Nov 12 07:54:44 CST 2001


> What I had in mind was running a query that selected all the
> values form the new info table that had a corresponding yes
> in the yes/no column of the old table, by default the linked column
> will be filled out.

hi alex

that's pretty straightforward, but  then you go on to say

> Once i have this list of values in the new table that correspond to the
> value i am looking for in the old table i will add the required columns
> from the old table and then run an update query to update the values
> in the new info table with the required fields to bring it into line with
> the information held on the old table. That way i think i will have a
> fully working table with all the values i need.

if your tables are

  oldtable ( oldid, oldphone, yesno, 50odd )

  newtable ( newid, newphone )

then just run this query to combine the latest data --

   select newid, newphone, yesno, 50odd
      into new2table
   from oldtable inner join newtable on oldid=newid

this is microsoft access syntax to store the result of the query into a new
table that it will create "on the fly" so to speak

new2table will have all ids that are common to both tables, the new phone
numbers from your new table, and the yesno and 50odd columns from the old
table

after ensuring that there are no rows in oldtable that don't exist in
newtable and vice versa, you can then ditch the original two tables


rudy






More information about the thelist mailing list