SQL Get All Data With The Given IDs And With The Same Data On Single Column
It is not absolutely clear what you expect as la should yield te result f 1,3,4 see query below


CREATE TABLE table1
    (`id` int, `col1` varchar(6), `name` varchar(6))
;
    
INSERT INTO table1
    (`id`, `col1`, `name`)
VALUES

    ('1', 'a', 'la'),
    ('2', 'b', 'ria'),
    ('3', 'w', 'la'),
    ('4', 'q', 'la'),
    ('5', 'y', 'ria');




SELECT id 
FROM table1 
WHERE `name` IN (SELECT `name` FROM table1  GROUP BY `name` HAVING COUNT(`name`) &gt; 2)
AND id IN (1,2,3,5)


| id |
| -: |
|  1 |
|  3 |




SELECT `name` FROM table1  GROUP BY `name` HAVING COUNT(`name`) &gt; 2


| name |
| :--- |
| la   |


db&lt;&gt;fiddle here