How do I output the sql query records with the same code?

How do I output the sql query the records in which OrderID is the same?
For example there is a table
Kottakota Name
1. Muromets
2. Nikitich
2. Muromets
3. Dance
3. Nikitich

How to withdraw in two separate tuple record ID 2 and record ID 3

If anyone is interested. Solved the problem using function in SQLite: GROUP_CONCAT()
5e4ae408c5c6f204415756.png
April 7th 20 at 15:25
3 answers
April 7th 20 at 15:29
SELECT * FROM table WHERE code = 1;
April 7th 20 at 15:31
if I correctly understood the task:
SELECT * FROM table
WHERE id= 2
UNION 
SELECT * FROM table
WHERE id = 3;
April 7th 20 at 15:27
-- Create a temporary table for the example implementation
Create table #tt1
(_Code nvarchar(10),
_Name nvarchar(100))

-- Fill temporary table with test data
Insert into #tt1 
Select '1.', 'Murom'
Insert into #tt1 
Select '2.', 'Nikitich'
Insert into #tt1 
Select '2.', 'Murom'
Insert into #tt1 
Select '3.', 'Dance'
Insert into #tt1 
Select '3.', 'Nikitich'

-- Select rows where field _Code is repeated 2 or more times
Select
t1._Code,
t1._Name,
t3.Counter
From
#t1 as tt1
inner join(
 Select 
 t2._Code, 
 COUNT(t2._Name) as counter 
 from #tt1 as t2

 group by 
t2._Code
 Having COUNT(t2._Name) >1
 ) as t3
on t1._Code = t3._Code

-- Delete the temporary table.
drop table #tt1

Find more questions by tags SQL