Find all occurrences of a value in the same table from a different column

I have a relatively large table. In this table I have the following column definitions.

Table: WORK_ORDER_MGMT
ID || WORK_ORDER_ID || … || ADDONS
1 || 123456 || … ||
2 || 234567 || … || 123456
3 || 345678 || … ||
4 || 456789 || … || 123456

ID is the primary key for the row. Whilst having normalized tables would be desirable, I don’t have my that option because of legacy code.

How can I return a list of all “ADDONS” where the referenced WORK_ORDER_ID is being used?

I’ve tried to use [_THISROW] but am not getting any results.

My expression thus far that I’ve applied to a virtual column on WORK_ORDER_MGMT
SELECT(WORK_ORDER_MGMT[ID],([_THISROW].[WORK_ORDER_ID] = [ADDONS]))

0 5 193
5 REPLIES 5
Top Labels in this Space