I have a table like below.
One table for storing fruits and one for its type.
create table fruits(fruit_id int, fruit_name VARCHAR(255));
create table type(fruit_id int, status VARCHAR(255));
INSERT INTO fruits(fruit_id, fruit_name)
values(101, 'Apple'),
(102, 'Mango'),
(103, 'Lemon'),
(104, 'Grape'),
(105, 'Orange');
INSERT INTO type(fruit_id, status)
values(101, 'Edible');
(101, 'Sweet'),
(102, 'Edible'),
(103, 'Edible'),
(103, 'Salty'),
(103, 'Sour'),
(104, 'Sour');
Now I want a output like below
Fruit_id FruitName
101 Apple
102 Mango
103 Lemon
104 Grape
I used INNER JOIN
but its getting repeated rows for apple, lemon and Grapes
SELECT fruits.*
FROM fruits INNER JOIN type
ON type.fruit_id = fruits.fruit_id