DROP VIEW LD0V0DOCUMENTTYPE 
;

CREATE VIEW LD0V0DOCUMENTTYPE AS SELECT CONCAT(D.VALUE, '.', B.CS_ID) AS 'DOCUMENT TYPE ID', C.VALUE AS 'DESCRIPTION'
  FROM LD0V0TERMSYSTEM AS A 
  LEFT JOIN LD0V0TERMITEMENTRY AS B 
  ON A.ID=B.TERMSYSTEM_ID
  LEFT JOIN LD0V0TERMITEMENTRYATTR AS C 
  ON B.ID=C.TERMITEMENTRY_ID 
  AND C.TYPE='SHORTNAME'
  LEFT JOIN LD0V0TERMSYSTEMATTR AS D 
  ON D.TERMSYSTEM_ID=A.ID
  AND D.TYPE = 'version'
  WHERE A.CS_ID='1.2.246.537.6.1506'
;