I was able to formulate the following solution with the help of my colleague
SELECT * FROM E1.E_STProcedure WHERE STProcedureID IN
(SELECT ST2.STProcedureID FROM E1.E_STProcedure ST1
JOIN E1.E_STProcedure ST2 ON ST1.GroupID LIKE '%'+ST2.STProcedureID+'%'
WHERE ST1.STProcedureID ='||OWNER||')
Explanation
WHERE clause
What happens here is that the WHERE
clause will definitely cut down the result to a single record from ST1
relative to the respective GUID
||OWNER||
Lets simplify with the following example
WHERE ST1.STProcedureID ='17bfa492-8464-423f-a5f4-32978186e112'
JOIN clause
The JOIN
statement brings out the juice, The single entry from ST1.GroupID
is checked for its containing sub-string from ST2.STProcedureID
as shown below
E1.E_STProcedure ST1
JOIN
E1.E_STProcedure ST2
ON
ST1.GroupID LIKE '%'+ST2.STProcedureID+'%'
I hope the code is pretty readable for you all.