请帮助我求和...
select SUM(free),SUM(Paid),SUM(Guest)
from food_regs
where start date= 'date' and end date ='date'
答案 0 :(得分:0)
根据您的问题,我假设您需要特定日期的三个字段的总和。
然后尝试以下查询
$folder= "/student/" . rand(222,333333) . "/";
if (!file_exists($folder)) {
mkdir($folder);
}
$folder= $folder . $filename;
move_uploaded_file ($tempname, $folder);
答案 1 :(得分:0)
您是说要修改查询的日期部分吗?
select SUM(free),SUM(Paid),SUM(Guest)
from food_regs
where 'date' > '2018-11-11' and 'date' < '2019-01-14'
或者您是说想要总计,例如:
select SUM(free)+SUM(Paid)+SUM(Guest)
from food_regs
where 'date' > '2018-11-11' and 'date' < '2019-01-14'
答案 2 :(得分:0)
您可以尝试以下操作-使用分组依据,可以为您提供每个字段的员工明智的求和值
select emp_name,SUM(free) as totalfree,SUM(Paid) as totalpaid,SUM(Guest) as totalguest
from food_regs
where start `date`>= '2018-11-12' and end `date`<= '2019-01-14'
group by emp_name
答案 3 :(得分:0)
您想要分别在<Window
x:Class="WPFSandbox.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFSandbox"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Height="450"
ContentRendered="Window_ContentRendered"
ResizeMode="CanResize"
SizeChanged="Window_SizeChanged"
SizeToContent="Width">
<Grid x:Name="mainGrid">
<DataGrid x:Name="dataGrid"
AutoGenerateColumns="False"
CanUserResizeColumns="False"
HeadersVisibility="Column"
IsReadOnly="True"
ItemsSource="{Binding MyItems}">
<DataGrid.ColumnHeaderStyle>
<Style TargetType="{x:Type DataGridColumnHeader}">
<Setter
Property="SeparatorVisibility"
Value="Hidden" />
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.Columns>
<DataGridTextColumn x:Name="item1Column"
Binding="{Binding Item1}"
Header="Item1" />
<DataGridTextColumn x:Name="item2Column"
Binding="{Binding Item2}"
Header="Item2" />
</DataGrid.Columns>
</DataGrid>
</Grid>
和Free
之间存在Paid
,Guest
和start_date
的总和。
您可以尝试以下方法:
end_date