我正在尝试每周刷新数据并每周运行订阅。 我的问题是,
如果电子邮件已经发送给某人(记录在数据集中),而下周该数据集中也出现了同一个人,那么我不想为他发送订阅,而只想为新个人发送电子邮件。
示例
让我们说:
运行查询时,上周返回了三条记录:
Employee Id Employee Date
1001 Saifa 07-08-2018
1002 Oliver 06-08-2018
1003 Varun 07-08-2018
本周查询返回2条记录:
Employee Id Employee Date
1001 Saifa 13-08-2018
1005 Natasha 13-08-2018
该电子邮件仅应发送给Natasha,这怎么可能? 请帮忙。
谢谢! 信德省
答案 0 :(得分:0)
我想你想要
select t.*
from (select t.*,
min(date) over (partition by employeeid) as mindate
from t
) t
where mindate = '2018-08-13'
答案 1 :(得分:0)
这将排除具有上一个日期记录的员工。
public class MainViewModel : BindableBase
{
private readonly List<IViewModel> _viewModelCollection;
private ObservableCollection<IViewModel> _vmObservable;
public ObservableCollection<IViewModel> VmObservable
{
get { return _vmObservable; }
set
{
SetProperty(ref _vmObservable, value);
RaisePropertyChanged();
}
}
private IViewModel _activeVm;
public IViewModel ActiveVm
{
get { return _activeVm; }
set
{
SetProperty(ref _activeVm, value);
RaisePropertyChanged();
}
}
public DelegateCommand SetOneCommand { get; set; }
public DelegateCommand SetTwoCommand { get; set; }
public MainViewModel()
{
SetOneCommand = new DelegateCommand(SetOne);
SetTwoCommand = new DelegateCommand(SetTwo);
VmObservable = new ObservableCollection<IViewModel>();
_viewModelCollection = new List<IViewModel>()
{
new ViewModel1(),
new ViewModel2(),
new ViewModel3()
};
}
private void SetOne()
{
VmObservable.Clear();
VmObservable.Add(GetViewModel(typeof(ViewModel1)));
VmObservable.Add(GetViewModel(typeof(ViewModel2)));
VmObservable.Add(GetViewModel(typeof(ViewModel3)));
}
private void SetTwo()
{
VmObservable.Clear();
VmObservable.Add(GetViewModel(typeof(ViewModel2)));
VmObservable.Add(GetViewModel(typeof(ViewModel3)));
}
private IViewModel GetViewModel( Type viewModelType )
{
return _viewModelCollection.Find(x => x.GetType().Equals(viewModelType));
}
}
NOT IN将检查员工的先前日期。