我想结合2个表,但得到错误
var firstTabPath, secondTabPath, thirdTabPath,
firstTabTitle, secondTabTitle, thirdTabTitle,
firstTabContent, secondTabContent, thirdTabContent;
const getTabsTitlesInOrder = () => {
for(var i = 0; i <tabsJson.tabs.length; i ++){
switch(tabsJson.tabs[i].order){
case 0:
firstTabTitle = tabsJson.tabs[i].title;
getFirstTabContent(firstTabTitle);
break;
case 1:
secondTabTitle = tabsJson.tabs[i].title;
getSecondTabContent(secondTabTitle);
break;
case 2:
thirdTabTitle = tabsJson.tabs[i].title;
getThirdTabContent(thirdTabTitle);
break;
}
}
};
const getFirstTabContent = (firstTabTitle) => {
switch (firstTabTitle) {
case "Dummy Table":
firstTabContent = <DummyTable/>;
firstTabPath = "/dummyTable";
break;
case "Dummy Chart":
firstTabContent = <DummyChart/>;
firstTabPath = "/dummyChart";
break;
case "Dummy List":
firstTabContent = <DummyList/>;
firstTabPath = "/dummyList";
break;
}
};
const getSecondTabContent = (secondTabTitle) => {
switch (secondTabTitle) {
case "Dummy Table":
secondTabContent = <DummyTable/>;
secondTabPath = "/dummyTable";
break;
case "Dummy Chart":
secondTabContent = <DummyChart/>;
secondTabPath = "/dummyChart";
break;
case "Dummy List":
secondTabContent = <DummyList/>;
secondTabPath = "/dummyList";
break;
}
};
const getThirdTabContent = (thirdTabTitle) => {
switch (thirdTabTitle) {
case "Dummy Table":
thirdTabContent = <DummyTable/>;
thirdTabPath = "/dummyTable";
break;
case "Dummy Chart":
thirdTabContent = <DummyChart/>;
thirdTabPath = "/dummyChart";
break;
case "Dummy List":
thirdTabContent = <DummyList/>;
thirdTabPath = "/dummyList";
break;
}
};
class TabContent extends React.Component{
render() {
return(
<Switch>
<Route exact path={firstTabPath} component={firstTabContent}/>
<Route path={secondTabPath} component={secondTabContent}/>
<Route path={thirdTabPath} component={thirdTabContent}/>
</Switch>
);
}
};
class TabButtons extends React.Component{
render() {
getTabsTitlesInOrder();
return(
<div>
<div className="tabTitleWrapper">
<Link className="tabLink" to={firstTabPath}>
{firstTabTitle}
</Link>
</div>
<div className="tabTitleWrapper">
<Link className="tabLink" to={secondTabPath}>
{secondTabTitle}
</Link>
</div>
<div className="tabTitleWrapper">
<Link className="tabLink" to={thirdTabPath}>
{thirdTabTitle}
</Link>
</div>
</div>
);
}
};
class App extends React.Component{
render() {
return(
<div>
<TabButtons />
<TabContent />
</div>
);
}
};
ReactDOM.render((
<BrowserRouter>
<App />
</BrowserRouter>),
document.getElementById('tab')
);
但是得到错误:
proc sql;
select * from Table1
outer union corr
select * from table2;
如果我理解这是正确的并且基于UNION ALL two SELECTs with different column types - expected behaviour?,则第一列是不同的数据类型,不能继续使用union(这是真的)
ERROR: The type of column EntryId from the left hand side of the OUTER UNION set operation is
different from EntryId on the right hand side
但是,我想要使用的列具有相同的格式
RecordID num label='RecordID' format=20. informat=20.
and
RecordID num label='RecordID' format=11. informat=11.
并且在每个表中它们是第3列和第4列。
有没有办法使用该列作为引用将这些表联合起来,而不是原始的?
我试着无济于事:
Pseu char(64) label='Pseu' format=$64. informat=$64.
Pseu char(64) label='Pseu' format=$64. informat=$64.
它来自http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473694.htm上给出的OUTER UNION CORRESPONDING示例,并且基于我想要的内容:
proc sql;
select * from Table1
outer union corr
select * from table2
on Table1.Pseu=Table2.Pseu;
ERROR: Found "on" when expecting ;
答案 0 :(得分:0)
或许这样的事情:
proc sql;
select * from Table1
outer union corr
select p, r as r2, z from table2
列r。
的列别名使用常规UNION:
select p, r, y, null, null from Table1
outer union corr
select p, null, null, r as r2, z from table2
答案 1 :(得分:-1)
我的搜索和jarlh提供的答案是正确的。
由于要合并的数据集中的列的大小和数量,问题出现了。我必须确保在联合数据集中没有重复列名称(在我的总共600列中,有些名称相似),所以我不得不重命名列