I have a small SQL question, I want to insert into a table the unique values from another table, I have tried using a Select Distinct query but it still seems to return values that have more than one value in the table.
I want to insert into the table only the records from the other table where there is one of the records.
I have only two records in the source table, they are both EXACTLY the same, except for the autonumber.
I have written the SQL and clicked the button to run it and in my eyes there should be no records being inserted into the other table? I only want records from the source table to be inserted into the other table if there is only one site in the source table.
I dont know if that makes sense.
Here is what the table is for, might make more sense if i tell you what i am doing.
I am trying to insert records into a table so i can query the whole table to find out Sites that ar due a renewal contract for their maintainance, the maintainance table could have 6 years of renewals in for the same site so if they have more than one contract in the maintainance table then I dont want to send them a renewal contract.
At the moment the maintainance table has exactly the same information in twice so I know that there should be no records going into the table i want to query because that site has more than one contract in the table?
You see what I mean?
At the moment it is trying to insert 1 record into the other table and that isnt what I want it to do?
Works a treat that, need to brush up a little on my SQL i think, Ive only need to do really simple inserts up until that really! I think i ould get a lot more out of SQL if i read a little of the books!