I have a table that looks like this...
------------------------------------
| sku | superseded_sku |
------------------------------------
| PartA | PartC |
| PartB | PartC |
| PartC | PartD |
| PartD | |
I need to write a query that will show me all rows where an entry from coumn B appears in column A. For example here it would give me the following...
------------------------------------
| sku | superseded_sku |
------------------------------------
| PartC | PartD |
| PartD | |
I have tried this...
SELECT x.sku, x.superseded_sku FROM table x
JOIN table y ON y.sku = x.sku
WHERE y.superseded_sku = x.sku
but it returns nothing and now I don't know where to go from here
Think this query will give you the result:
SELECT x.sku, x.superseded_sku FROM table x
JOIN table y ON y.sku = x.superseded_sku
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.