如何在一个ASP GridView中组合4个MYSQL查询

时间:2015-10-05 08:46:39

标签: c# mysql asp.net gridview

我想在一个gridview中获得以下查询的结果

结果应

Early|Late|Excess 
SELECT reports.inone, SEC_TO_TIME(sum(TIMESTAMPDIFF(second,reports.inone,date_FORMAT(reports.inone,'%Y-%m-%d 08:00:00') ))) AS early
FROM `wave`.`reports` 
WHERE personnelnr=12793 
    and reportdate between "2015/01/01" and "2015/10/01" 
    and date_FORMAT(reports.inone,'%T') < '08:00:00' 
    and time_to_sec(reports.inone) <  28200
SELECT SEC_TO_TIME( sum(TIME_TO_SEC(reports.lateone ))) AS Late
FROM `wave`.`reports` 
where personnelnr=12319 
    and reportdate between "2015/09/01" and "2015/09/30"
    and reports.lateone >= '00:10:00';
SELECT SEC_TO_TIME( sum(TIME_TO_SEC(reports.otone))) AS Excess
FROM `wave`.`reports` 
where  personnelnr=12319 
    and reportdate between "2015/09/01" and "2015/09/30" 
    and reports.otone >= '00:10:00';

我应该使用什么数据集?我不想在一个Sql语句中进行所有查询请帮忙吗?

0 个答案:

没有答案