我有两个表A和B:
this.facebook.logEvent('fb_mobile_initiated_checkout');
我需要加入两者,以便:
A.id
A.name
B.id
B.A_id <-- points to A in a many to one relationship
B.tag <-- predefined integer
,返回的结果必须是这样,它将返回的所有A和B都只在 1、2、3 中,而不在 4、5 中。< / p>
如果返回的任何A联接都包含带有排除标记的B.tag,那么即使存在具有有效B.tag的A联接,我们也不应该看到它被返回。
即
SELECT A.name, B.name, B.tag FROM A INNER JOIN B ON A.id = B.a_id
WHERE (B.tag IN (1,2,3) AND B.tag NOT IN (4,5)
当我们执行查询时:
A.name = 'Bob'
A.id = 1
B.id = 1
B.A_id = 1
B.tag = 10
B.id = 2
B.A_id = 1
B.tag = 11
B.id = 3
B.A_id = 1
B.tag = 12
因为我们有SELECT A.id, B.id, B.tag FROM A INNER JOIN B ON A.id = B.a_id
WHERE (B.tag IN (10) AND B.tag NOT IN (11)
排除项,所以不会返回任何内容。这可能吗?
答案 0 :(得分:1)
我觉得您的解释有点难以理解。我认为您想要import React, { Component } from "react";
import { Collapse } from 'reactstrap';
import { Tab, Tabs } from 'react-bootstrap';
import { connect } from 'react-redux';
import { getAllChain } from '../../actions/terminalActions';
// Import React Table
import ReactTable from "react-table";
import "./react-table.css";
class Terminal extends Component {
constructor(props, context) {
super(props, context);
this.handleSelect = this.handleSelect.bind(this);
this.toggle = this.toggle.bind(this);
this.state = {
key: 1,
collapse: true,
data:[]
}
}
componentDidMount(){
this.props.getAllChain().then((d) => {
this.setState({
data: d.data.wrapper.db
});
})
}
handleSelect(key) {
this.setState({ key });
}
toggle() {
this.setState({ collapse: !this.state.collapse, condition: !this.state.condition });
}
render() {
const data = this.state.data;
console.log('Data:', data);
const column = [
{
id: "payload",
Header: "Data",
accessor: (d) => {
return d.payload = new Buffer(d.payload).toString();
},
style: {
textAlign: 'center'
},
},
];
return (
<div className="terminal term_tabs" style={{backgroundColor: "rgba(50, 50, 62, 0.4)"}}>
<div className="terminal-header">
<div className="terminal-title">
<div onClick={this.toggle} className={this.state.condition ? 'button' : 'button toggled'}>
<i className="fas fa-chevron-right" />
{' '}
</div>
Terminal
</div>
</div>
<Collapse isOpen={this.state.collapse}>
<Tab eventKey={1} title="Test">
<div className='tabs_body'>
<ReactTable
data={data}
columns={column}
defaultPageSize={10}
loading={this.props.isLoading}
className="-striped -highlight"
/>
</div>
</Tab>
</Tabs>
</Collapse>
</div>
);
}
}
const mapStateToProps = ({ terminalReducer: { items } }) => ({
items
});
export default connect (mapStateToProps, {getAllChain})(Terminal);
:
not exists