Column 列查询,如下: var dt = CommonUtil.ToDataTable(dataJson); //判断是否有当前日期数据 var systemDateTime = new CommonProperty().SystemDateTime; DataRow[] drArray = dt.Select(string.Format("COL_ActDate>='{0}' and COL_ActDate<'{1}'", systemDateTime.Date.T…
直接从某一列查询出最大值或最小值很容易,通过group by字句对合适的列进行聚合操作,再使用max()/min()聚合函数就可以求出. 样本数据如下: key_id x y z A 1 2 3 B 5 5 2 C 4 7 1 D 3 3 8 求查询每个key的最大值,展示结果如下: key_id col A 3 B 5 C 7 D 8 方案一: 对于列数不是很多的可以用case when语句, select key_id, case when case when x > y then x el…
oracle 多行转多列查询 ---create table Fruit(id int,name varchar(20), Q1 int, Q2 int, Q3 int, Q4 int);insert into Fruit values(1,'苹果',1000,2000,3300,5000);insert into Fruit values(2,'橘子',3000,3000,3200,1500);insert into Fruit values(3,'香蕉',2500,3500,2200,2…