我有一个包含// parent include this method
handleSetData = (myData) => {
this.setState({ myData: myData });
}
// inside render and your child component pass the method to it
<ChildComponent setData = {this.handleSetData} />
// Child Component, inside your button
<Text onPress={('Some data') => this.props.setData('Some data'})}></Text>
invoice_id
quantity
的表,现在我需要分别用相同的{{1}找到rate
和quantity
的总和}。
rate
这仅显示一个字段的结果,
答案 0 :(得分:0)
您可以找到多个列的总和,如下所示:
$invoices_quantity = Sale::select(
DB::raw('sum(quantity) as quantity_count'),
DB::raw('sum('rate') as rate_count')
->groupBy('invoice_id')
->get();