Have 2 tables. Table A has among several columns one called "product_code," which contains 4-digit numerals. Table B has just 2 columns, "product_code," the same 4-digit numerals used in the same column in Table A, and "product_description," which includes a VARCHAR string describing the product referenced by the code.
I'm querying Table A and trying to include the "product_description" from Table B with each record returned. Am using a LEFT JOIN like this:
SELECT * FROM Table_A
LEFT OUTER JOIN Table_B ON Table_A.product_code = Table_B.prod_code
This works fine EXCEPT in cases where Table A has more than one value in "product_code," in which case I get no match in Table B and "NULL" is returned for "product_description."
When there is more than one value in the "product_code" column in Table A for a particular record, the values are separated by commas (for example: 1002,1003,9856).
How can I get this to work so that for records that have multiple produce codes in table A I get multiple product descriptions from Table B?
View Complete Post