View Single Post
  #8 (permalink)  
Old March 22nd, 2007, 06:45 AM
pallone pallone is offline
Friend of Wrox
Points: 1,243, Level: 13
Points: 1,243, Level: 13 Points: 1,243, Level: 13 Points: 1,243, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2003
Location: , , United Kingdom.
Posts: 290
Thanks: 24
Thanked 0 Times in 0 Posts
Default

Hi Vijay G,

Many thanks for your help.

I have just seen your post and will try the code straight away. However, I think there is a problem with the code because I can have ID repetitions in table CompareCompany if the Name field is similar. Please have a look at the example table below.

1 - I will need to insert both IDs in CompareTable since the ID from country 1 is different from country 2
2 - People will type the name of the company differently i.e some people will use abbreviations.
3 - If the Name field is exactly the same then I just need to update the record with the values from table 1 but also need to add the ID from table 2.
4 - If the Name field is similar then I need to insert both records from table 1 and table 2 including the IDs of both.


CompareTable
+------------+----------+------------+-----------------------+
| IDTab1 | IDTab2 | Name | MaxValue |
+------------+----------+------------+-----------------------+
| 1 | 37 | Wilbey sx | 2000 |
+------------+----------+------------+-----------------------+
| 2 | 104 | Aimor sp | 10000 |
+------------+----------+------------+-----------------------+
| 2 | 104 | Aimor | 10000 |
+------------+----------+------------+-----------------------+
| | | | |
+------------+----------+------------+-----------------------+

Table 1
+------------+----------+------+-----+
| ID | Name | MaxValue |
+------------+----------+------+-----+
| 1 | Wilbey sx| 2000 |
+------------+----------+------+-----+
| 2 | Aimor sp | 10000 |
+------------+----------+------+-----+

Table 2
+------------+----------+------+-----+
| ID | Name | MaxValue |
+------------+----------+------+-----+
| 37 | Wilbey sx| 6000 |
+------------+----------+------+-----+
| 104 | Aimor | 10000 |
+------------+----------+------+-----+
Reply With Quote