我需要计算准时到达和离开的时间。查询准时出发:
SELECT DEPAIRPORT as AIRPORT,
COUNT(case when A.STATUS = 'Scheduled' and
A.ACTUAL_BLOCKOFF is not null then 1 else NULL END) as SCHEDULED,
COUNT(case when ((A.ACTUAL_BLOCKOFF+ interval '7' hour) - (A.SCHEDULED_DEPDT+ interval '7' hour))*24*60 <= '+000000015 00:00:00.000000000' and
A.ACTUAL_BLOCKOFF is not null then 1 else NULL END) as ONTIME
FROM TABLE A GROUP BY DEPAIRPORT
和查询以计算准时到达:
SELECT COUNT(case when ((A.ACTUAL_BLOCKON + interval '7' hour) - (A.SCHEDULED_ARRDT+ interval '7' hour))*24*60 <= '+000000015 00:00:00.000000000' and
A.ACTUAL_BLOCKON is not null then 1 else NULL END) as ARRONTIME
FROM TABLE A
GROUP BY ARRIVALAIRPORT
如何将这些查询合并为1个单个查询,以便可以将其显示为以下表格:
Name #Schedule #OnTimeDeparture #ArrivalOntime
AIRPORTX 41 35 20
答案 0 :(得分:0)
您可以使用以下内容:
List<Foo>
但是我想你的问题还不完整。另外,您还需要一把钥匙才能加入不同的航班。
答案 1 :(得分:0)
没有示例数据和预期输出,很难说出您到底想要什么。如果要合并这两个数据集,可以将它们放在export default class Questionone extends Component {
constructor(props) {
super(props)
this.state = {
Question : '' ,
suggestion : [] ,
itemIndex : 0
}
}
aaa(){
console.log(typeof(this.state.suggestion));
return this.state.suggestion ;
}
componentDidMount(){
var str = 'test/' + this.props.navigation.state.params.listeQuestion ;
console.log(str) ;
firebase.database().ref(str).on('value' , (data)=> {
var datareturn = data.toJSON() ;
var i = 0 ;
this.setState({question : datareturn["Q1"]["question"]}) ;
for (var element in datareturn["Q1"]["suggestion"] ) {
var sugg = {label : element , value : i}
this.setState({
suggestion : this.state.suggestion.push(sugg)
}) ;
i++ ;
}
});
console.log(this.state.suggestion) ;
console.log(typeof(this.state.suggestion));
console.log("********************") ;
}
render() {
return (
<View style={{flex : 1 , flexDirection : 'column' ,}}>
<Text style = {{ flex :1 , marginBottom : 3 , marginLeft : 3 , marginRight : 3 , marginVertical : 3 }}>
{this.state.question}
</Text >
<RadioForm
style={{flex : 2.5 , marginBottom: 10, marginTop: 10,}}
radio_props = {this.aaa()}
onPress = {(value , itemIndex) => {this.setState({value : value , itemIndex : itemIndex})}}
/>
<Button style={{flex : 3 , marginBottom : 20}} title = "next" onPress ={()=> this.props.navigation.navigate('questiontwo' , {listeQuestion : this.state.itemIndex})} />
</View>
)
}
}
子句中,然后根据尚未到达的情况所需的输出将它们合并在一起(with
或LEFT JOIN
还是不可以)
INNER JOIN