CodePudding user response:
Don't select all the columns. select columns which you need from any table using tableName.columnName
SELECT
product.product_id,
product.product_name,
product.price ,
product_image.added_on,
product_image.modified_on
FROM product_image
inner join product
on product_image.product_id = product.product_id
ORDER BY id DESC
CodePudding user response:
Just use it with the table name as alias:
SELECT product.product_id,
product.product_name,
product.price,
product_image.id,
product_image.product_id,
product_image.product_image1,
product_image.added_on,
product_image.modified_on
FROM product_image
INNER JOIN product ON product_image.product_id = product.product_id
ORDER BY product_image.id DESC
This way you make sure you take the columns from the table you want to.