来自另一个数据库的一个表的SQL更新

时间:2015-08-08 18:21:48

标签: mysql sql

我有2个MySQL数据库 - 名为' basemodel'和' TRAK'。

我希望在TRAK中将一些值设置为basemodel中特定列的值。

我尝试了以下内容:

UPDATE TRAK.Argument t
SET 
t.`object ID`= basemodel.t_object.Object_ID, 
t.`AD exchange element owning ID`= basemodel.t_object.ea_guid,
t.`argument description` = basemodel.t_object.Note


FROM  basemodel.t_object
WHERE basemodel.t_object.Stereotype ='Argument' 

但是MySQL返回一个错误,表明语法错误在' FROM basemodel.t_object'附近。我从SQL工具的自动完成知道\该列存在如此清楚,我已经在附近发生了某种错字。

basemodel.t_object中典型的数据子集是:

Object_ID,Object_Type,Diagram_ID,Name,Author,Note,Stereotype
1893,Text,230,5.4 Architecture Viewpoints :MV-03 Section 5.4 Architecture Viewpoints - Requirements,Nic Plum,,
1894,Class,0,A TRAK-conforming architecture view meets the requirement to include identifying and supplementary information.,Nic Plum,,Claim
1895,Class,0,A TRAK-conforming architecture view is required to include a version number for the view.,Nic Plum,,Argument
1896,Text,0,,Nic Plum,,
1897,Class,0,"TRAK states that the version of TRAK against which the architecture description (view set) was produced may be stated and that if it isn't stated it is assumed that the latest (current) current version of the TRAK specification set (TRAK, Metamodel and Vi",Nic Plum,,Argument
1898,Class,0,"TRAK defines a viewpoint numbering convention - every TRAK viewpoint has a 'Vp' in its identifier which is preceded by the first letter of the TRAK perspective that the viewpoint belongs to.",Nic Plum,,Argument
1899,Class,0,"TRAK defines a view identification convention. Every TRAK view can be identified by the first letter of the TRAK perspective that the view belongs to followed by a 'V' e.g. SV-01, MV-02. If further differentiation is needed from other frameworks a namespa",Nic Plum,,Argument
1900,Class,0,A TRAK view is able to identify its governing viewpoint through the view identifier because the viewpoint and view have corresponding identifiers e.g. MVp-02 (Architecture Description Design Record Viewpoint) vs MV-02 (Architecture Description Design Reco,Nic Plum,,Argument
1901,Artifact,0,Viewpoint Identification,Nic Plum,,Evidence
1902,Class,0,The tuples in a TRAK viewpoint define a subset of the TRAK metamodel that addresses the concerns framed by the viewpoint.  A TRAK viewpoint is selected by the architect based on the concerns it frames (addresses).,Nic Plum,,Argument
1903,Artifact,0,Viewpoint Selection,Nic Plum,,Evidence
1904,Class,0,"TRAK defines an element in its metamodel that is used to represent an issue. It is called a 'Concern'. It can be related to any object within the TRAK metamodel using the 'Concern about ...' tuple. ",Nic Plum,,Argument
1905,Class,0,"The 'Concern about' tuple is a universal tuple. It is defined as an optional tuple in every TRAK viewpoint allowing a Concern to be added to every TRAK view. ",Nic Plum,,Argument
1906,Artifact,0,TRAK Metamodel - Concern,Nic Plum,,Evidence
1907,Class,0,"The 'Concern about [element]' is a mandatory tuple for the MVp-02 Architecture Description Design Record Viewpoint and therefore is mandatory for a conforming TRAK architecture description.",Nic Plum,,Argument
1908,Note,0,,Nic Plum,,
1909,Text,0,,Nic Plum,,

表TRAK.Argument为空。

它具有以下结构:

CREATE TABLE `Argument` (
  `object ID` int(11) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `AD exchange element owning ID` varchar(255) DEFAULT NULL,
  `AD exchange element owning organisation` varchar(45) DEFAULT NULL,
  `AD exchange element recipient element name` varchar(255) DEFAULT NULL',
  `AD exchange element recipient element ID` varchar(45) DEFAULT NULL,
  `AD exchange element recipient organisation` varchar(45) DEFAULT NULL,
  `AD exchange element external reference` varchar(45) DEFAULT NULL,
  `AD exchange element reference URL` varchar(255) DEFAULT NULL',
  `pm national caveat` varchar(45) DEFAULT NULL,
  `pm codeword` varchar(20) DEFAULT NULL,
  `pm descriptor` varchar(20) DEFAULT NULL,
  `pm marking` varchar(25) DEFAULT NULL,
  `pm commercial` varchar(45) DEFAULT NULL,
  `pm marking owner` varchar(45) DEFAULT NULL,
  `element URI` varchar(255) DEFAULT NULL,
  `reference URL` varchar(255) DEFAULT NULL,
  `rationale` longtext,
  `argument ID` int(11) DEFAULT NULL,
  `argument description` longtext,
  `submission date` datetime DEFAULT NULL,
  `acceptance date` datetime DEFAULT NULL,
  `description` longtext COMMENT ,
  PRIMARY KEY (`object ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

0 个答案:

没有答案