答案 0 :(得分:0)
尝试使用foreach (var systemDto in systems)
{
var sourceConnectionString = _systemService.GetConnectionStringAsync(systemDto.Ip).Result;
var dbConnectionFactory = new DbConnectionFactory(sourceConnectionString,
"System.Data.SqlClient");
var dbContext = new DbContext(dbConnectionFactory);
var storageRepository = new StorageRepository(dbContext);
var usedStorage = storageRepository.GetUsedStorageForCurrentMonth();
var dtUsedStorage = new DataTable();
dtUsedStorage.Load(usedStorage);
var dcIp = new DataColumn("IP", typeof(string)) {DefaultValue = systemDto.Ip};
var dcBatchDateTime = new DataColumn("BatchDateTime", typeof(string))
{
DefaultValue = batchDateTime
};
dtUsedStorage.Columns.Add(dcIp);
dtUsedStorage.Columns.Add(dcBatchDateTime);
using (var blkCopy = new SqlBulkCopy(destinationConnectionString))
{
blkCopy.DestinationTableName = "dbo.tbl";
blkCopy.WriteToServer(dtUsedStorage);
}
}
的{{1}} .. Group by
条款来查找从未获得过世纪的球员姓名
Having
答案 1 :(得分:0)
MAX()
答案 2 :(得分:0)
使用GROUP BY ... HAVING
SELECT name
FROM table1
GROUP BY name
HAVING MAX(score) < 100
答案 3 :(得分:0)
试试这个,这里的表名是tblScore
select name,max(score) max_score from tblScore group by name
having max(score)<100
结果是
|name | max_score|
....................
|kumble | 77
|prasad | 12
答案 4 :(得分:0)
尝试Group By
和Having
组合
SELECT
name
FROM [Table Name]
GROUP BY
name
HAVING
MAX(score) < 100