如题,我在A表中有2个字段,注册时间(t1)、再次注册时间(t2),现在想统计每天注册的人数,
如果表中的某条数据,t1有值、t2没值======就按t1统计,
如果表中的某条数据,t1有值、t2有值======此时就把这条数据对应的t2值替换成t1来统计,但并数据库中的t1值并没有被t2更新,请问怎么解决呢,谢了
select t1 from user group by t1 .......这种的
如果表中的某条数据,t1有值、t2没值======就按t1统计,
如果表中的某条数据,t1有值、t2有值======此时就把这条数据对应的t2值替换成t1来统计,但并数据库中的t1值并没有被t2更新,请问怎么解决呢,谢了
select t1 from user group by t1 .......这种的
解决方案 »
- 'Sys'未定义,其中的一种解决办法跟大家分享一下
- asp.net 屏幕截图(WEB)
- System.Web.UI.MobileControls Mobile:Form 怎么添加Hidden隐藏域 vs2005
- 关下关于Wizard控件的一个问题
- GridView自定义模版中添加了RadioButton控件,但RadioButton的CheckedChange()事件居然不好使了?
- 大开DOTNET新建,发现C#中没有WebPart项目,是什么没有安装吗?那里下载?
- 谁有P2P视频源码 ,好心分享下吧。
- ASP.NET(C#)如何将SQL SERVER数据导出到EXCEL
- 请教:dropdownlist触发selectindexchange后,如何不刷新页面?
- 在.Net中怎样限制页面大小(800x600)
- 最近网页需要注册的可以使用QQ登录
- SQL语句写在哪层?
union all
select t2 from user where t1 is not null and t2 is not null group t2
DELCARE @TMPT1 int
DELCARE @TMPT2 INT
DELCARE @sql varchar(100)
SET @TMPT1=(
SELECT COUNT(0) FROM A where t1 <>'')
SET @TMPT2 =(
SELECT COUNT(0) FROM A where t2 <>''
)
IF(@TMPT1<>'' && @TMPT2='')
set @sql=(SELECT COUNT(t1) FROM A group by t1)
IF(@TMPT1<>'' && @TMPT2<>'')
set @sql=(SELECT COUNT(t2) FROM A group by t2)
select @sql
declare @t table(regTime datetime,reg2Time datetime)insert into @t
select '2011-10-10',null
union all
select '2011-10-10','2012-3-15'
union all
select '2011-10-11',null
union all
select '2011-10-12','2012-3-16'
union all
select '2011-10-12','2012-3-16'
union all
select '2011-10-13','2012-3-17'
union all
select '2011-10-13','2012-3-17'
union all
select '2011-10-13','2012-3-18'select count(1) as 注册人数 from @t group by (case reg2Time when null then regTime else reg2Time end)