你要什么结果?
select name,count,date,unit,(select sum(b.count) from table1 b where b.name=a.name) sum(count) from table1 a
select name,max(date),max(unit),sum(count) from table1 group by name
不知道你要哪个?还是要别的什么结果?
select name,count,date,unit,(select sum(b.count) from table1 b where b.name=a.name) sum(count) from table1 a
select name,max(date),max(unit),sum(count) from table1 group by name
不知道你要哪个?还是要别的什么结果?
很郁闷 耽误了很长时间
from table a,(select sum(b.count) count1 from table group by b.name) b
where a.name = b.name and
a.count = b.count and
a.date = b.date and
a.unit = b.unit
select name,count,date,unit,(select sum(b.count) from table1 b where b.name=a.name and date<=time1 and date>=time2) sum(count) from table1 a
where date<=time1 and date>=time2时
sum(count)段却没有了任何值 why? 而在子查询里 只加date<=time1 或date>=time2时都能正确选出 我敢保证time字符串绝对没有问题 那问题处在哪里呢??高人解决~