SQL add column to row with the same ID

Hi Experts,
I have the following table(Table1).  In the table, when the Type is X, it would have the same ID of another entry.
I want to query the table for Select * from Table Where Type='X';
However, I want to also include the Type from the entry with the same ID.
For example,
The output I am expecting from the Table is is something like:
122 | 200 | 4 | X | I
432 | 200 | 1 | X | O

How can I get it.  Thank you.

ID | Number | Duration     |  Type
122   | 200            |  5              |    I
122   | 200            |  4              |    X
222   | 300            |  4              |   O
332   | 200            |  3              |   O
432   | 200            |  3              |   O
432   | 200            |  1              |   X
512   | 300            |  2              |  O
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Missus Miss_SellaneusCommented:
Select * from table WHERE id IN (SELECT id FROM table WHERE type="X")
ambuliAuthor Commented:
I want to get the results as
122 | 200 | 4 | X | I
432 | 200 | 1 | X | O
Want the Type(I or O) to be in the results.
Missus Miss_SellaneusCommented:
I'm not sure what you're looking for.. this?

SELECT id, number, duration, "X" AS x, type from table WHERE type IN ("I","O") AND id IN (SELECT id FROM table WHERE type="X")
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Select distinct a.*, b.Type Type2
from Table1 a left join
	select a.* from Table1 a
	Where a.Type <> 'X'
) b
on a.ID = b.ID
Where a.Type='X'

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.