Msi77
800 pts. | Jun 3 2009 6:35AM GMT
I think you need to change the design of Rules table, so it is not in 1NF.
You’ll have no issues with join if this table will be
id unitid
1 A1
1 A2
2 A1
2 A3
PK={id, unitid}
Darryn
370 pts. | Jun 3 2009 10:37AM GMT
Or, update your query (should work, but haven’t tested).
select r.unitid ,(select distinct description from unittypes where
unittypes.unitid in ( (””+ REPLACE(r.unitid,’,',””+’,'+””)+””) ) FOR XML PATH(”) ) o
from rules r
Agree with advice from Msi77 though, it would be better to change the design.
mrdenny
46795 pts. | Jun 4 2009 8:11PM GMT
A table redesign is the way to go here. This is one of the many reasons that you don’t store more than one value in a single field.






