Reputation: 75
I have a table with column indicate sync to all or specific node, the data will be "ALL" or "001" for example.
However, one same record could be configured with "ALL" or "001", the record "ALL" could be overwriting my "001" record...
How can I specified in sym router, that I route "ALL" record to the node if none "001" record exist ?
Upvotes: 0
Views: 184
Reputation: 526
I believe you can achieve this with the following subselect query.
This will check to see if the target node matches the records external_id or if the external_id is 'ALL' it will check to make sure there are no other records in the table with the node's id.
c.external_id = :ROUTE_TO
OR (:ROUTE_TO = 'ALL' AND c.external_id NOT IN (
select distinct route_to from my_table where route_to = :ROUTE_TO
)
)
I still feel like something is missing. Is this some type of parameter table? If so, you would want to modify the inner select to make sure you aren't looking at the full table but only records that match on parameterName.
Upvotes: 0
Reputation: 64632
let’s say your table is ‘my_table’ and the routing column is ‘route_to’. set the subselect query column of sym_router to
c.external_id in (select distinct sn.external_id
from sym_node sn
where (sn.external_id = :ROUTE_TO or ‘ALL’ = :ROUTE_TO))
Upvotes: 0