Reputation: 3575
I have various columns in an SQL
table in column C
I have ID
that fits one of the rows but from column ID
. when I find this row I need to get value from column B and show it as separate table.
Example:
ID B C
1 text 3
2 text
3 value2get
Now I need to
So the result shall be:
ID B C NewColumn
1 text 3 value2get
I'm sorry for this table structure. How can i achieve this?
Upvotes: 1
Views: 70
Reputation: 15379
If I understand better:
Try this:
SELECT T1.id, T1.B, T1.C, T2.B as NewColumn
FROM yourTable T1
LEFT OUTER JOIN yourTable T2
ON T1.c = T2.id
WHERE T1.c IS NOT NULL
Upvotes: 3