Select 如何在日期之间进行选择

Select 如何在日期之间进行选择,select,subsonic,Select,Subsonic,谁能告诉我如何在亚音速项目中执行选择功能,以查询从今天起两周内将过生日的所有客户 桌上顾客 托马斯 1981年9月19日 谢谢请尝试以下方法: new Select("Provider").From("Customers") .Where("CustomerName") .IsEqualTo("Thomas") .Where("DOB") .IsBetweenAnd(DateTime.Today, DateTime.Today.AddDays(14)); PS:-提供商是您的亚音速提供商名称。

谁能告诉我如何在亚音速项目中执行选择功能,以查询从今天起两周内将过生日的所有客户

桌上顾客 托马斯 1981年9月19日

谢谢

请尝试以下方法:

new Select("Provider").From("Customers")
.Where("CustomerName")
.IsEqualTo("Thomas")
.Where("DOB")
.IsBetweenAnd(DateTime.Today, DateTime.Today.AddDays(14));
PS:-提供商是您的亚音速提供商名称。

请尝试以下操作:

new Select("Provider").From("Customers")
.Where("CustomerName")
.IsEqualTo("Thomas")
.Where("DOB")
.IsBetweenAnd(DateTime.Today, DateTime.Today.AddDays(14));

PS:-提供商是您的亚音速提供商名称。

如果您只使用一个提供商,大多数人都是,并且您希望利用亚音速为您生成的表结构:

CustomerCollection customers = DB.Select().From(Customers.Schema)
  .Where(Customers.Columns.CustomerName).IsEqualTo("Thomas")
  .And(Customers.Columns.DOB).IsBetweenAnd(DateTime.Today, DateTime.Today.AddDays(14))
  .ExecuteAsCollection<CustomerCollection>();

如果您只使用一个提供者,大多数人都使用,并且您希望利用亚音速为您生成的表结构:

CustomerCollection customers = DB.Select().From(Customers.Schema)
  .Where(Customers.Columns.CustomerName).IsEqualTo("Thomas")
  .And(Customers.Columns.DOB).IsBetweenAnd(DateTime.Today, DateTime.Today.AddDays(14))
  .ExecuteAsCollection<CustomerCollection>();

我想我需要更多地解释我想要什么,我想在接下来的2周内,在他/她的生日前2周、生日前3天和生日前1天,向所有生日在未来2周内的客户发送一封电子邮件

我想我需要更多地解释我想要什么,我想在接下来的2周内,在他/她的生日前2周、生日前3天和生日前1天,向所有生日在未来2周内的客户发送一封电子邮件

在SQL Server中,这类似于

select name, dob 
from customer
where datediff(day,getDate(),dob)+1 = 14 
or datediff(day,getDate(),dob)+1 = 3
or datediff(day,getDate(),dob)+1 = 1
在亚音速中,你可以这样写:

new Select(Customer.NameColumn, Customer.DobColumn)
.From(Customer.Schema)
.Where("datediff(day,getDate(),dob)+1=14")
  .Or("datediff(day,getDate(),dob)+1=3")
  .Or("datediff(day,getDate(),dob)+1=1")

在SQL Server中,这类似于

select name, dob 
from customer
where datediff(day,getDate(),dob)+1 = 14 
or datediff(day,getDate(),dob)+1 = 3
or datediff(day,getDate(),dob)+1 = 1
在亚音速中,你可以这样写:

new Select(Customer.NameColumn, Customer.DobColumn)
.From(Customer.Schema)
.Where("datediff(day,getDate(),dob)+1=14")
  .Or("datediff(day,getDate(),dob)+1=3")
  .Or("datediff(day,getDate(),dob)+1=1")
您应该能够编辑问题以将此信息添加到其中。您应该能够编辑问题以将此信息添加到其中。