我正在尝试从表中选择 3 列的最大值。从查询返回的所有字段都是字符串。
我到目前为止所拥有的
var step1 = from result in t_hsbc_staging_trts_derived_tbl_ac_balance.AsQueryable()
where result.branch_no == brnchnu
&& result.deal_id == dealid
&& result.group_mbr == grpmem
&& result.ac_type != "RMC"
select result ;
var branch = from result in step1
select new {ccbranch = result.cc_branch.Max()};
var sect = from result in step1
select new { ccsect = result.cc_sect.Max()};
var dept = from result in step1
select new { ccdept = result.cc_dept.Max()};
foreach (var result in branch)
{
string cc_branch = result.ccbranch.ToString();
}
我在 foreach 语句中遇到的错误是:
'System.String' 类型不支持序列运算符。
必须有一种更简单的方法来从该表中获取最大值吗?