> Dear all, > > I have two tables,let's call then a and b: > > Table a: > > CUI1|CUI2 > C001|C002 > C002|C003 > C003|C055 > C004|C002 > ... > > Table b: > CUI|STY > C001|T001 > C002|T002 > C003|T003 > C004|T004 > C005|T006 > C055|T061 > .. > > And the join table should be: > T001|T002 > T002|T003 > T003|T061 > T004|T002 > ...
I assume that the third table should be the result. If you need to store the result in a table you can use a INSERT ... SELECT query instead of only a SELECT (look INSERT...SELECT up in the online manual). > So,I should "convert" table a according to table b. Thank you in advance > for all your help My approach would be the opposite: SELECT t1.`STY`, t3.`STY` FROM `table_b` AS t1 JOIN `table_a` AS t2 ON t1.`CUI` = t2.`CUI1` JOIN `table_b` AS t3 ON t2.`CUI2`=t3.`CUI`; table_a determines which records from table_b must be connected. -- Jigal van Hemert. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]