Assuming your names are unique, you could use either this -
Code:
SELECT T1.name, T1.age, T1.weight, T1.sample_num
FROM MyTable as T1, MyTable as T2
WHERE T1.Name = T2.Name
AND T1.Type = '1'
AND T2.Type = '2';
or this -
Code:
SELECT T1.name, T1.age, T1.weight, T1.sample_num
FROM MyTable as T1
WHERE T1.Type = '1'
AND T1.Name IN
(SELECT T2.Name
FROM MyTable as T2
WHERE T2.Type = '2'
);
or this -
Code:
SELECT T1.name, T1.age, T1.weight, T1.sample_num
FROM MyTable as T1
INNER JOIN
MyTable as T2
ON T1.Name = T2.Name
WHERE T1.Type = '1'
AND T2.Type = '2';
You should take the quotes off the '1' and '2' if they're numeric types.