General discussion

Locked

liujun

By liujun ·
Tags: Off Topic
blog root

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

I want to be stronger!

by liujun In reply to liujun

<h4>I want to be stronger!</h4>

Collapse -

I want to be stronger!

by liujun In reply to I want to be stronger!

Sometimes I feel weak,
Sometimes I feel helpless,
and somtimes I feel alone.

I want to change my life,so I will be stroger!

Collapse -

现在也有个数据统计的问题困绕着我

by liujun In reply to liujun

<a><A class=f1>  <P>  <b>问:现在也有个数据统计的问题困绕着我。见如下数据,我要得到的是encode在哪几天里没有销售,求SQL语句,要考虑性能问题(表里有几百万条记录,而且每天都在增长)。</b></P> <P>  有如下的数据</P> <P> <TABLE cellSpacing=</a>

Collapse -

现在也有个数据统计的问题困绕着我

by liujun In reply to liujun

<a><A class=f1>  <P>  <b>问:现在也有个数据统计的问题困绕着我。见如下数据,我要得到的是encode在哪几天里没有销售,求SQL语句,要考虑性能问题(表里有几百万条记录,而且每天都在增长)。</b></P> <P>  有如下的数据</P> <P> <TABLE cellSpacing=</a>

Collapse -

现在也有个数据统计的问题困绕着我

by liujun In reply to liujun

<a><a class="f1">
<p>
<table cellspacing="0" cellpadding="0" width="92%" align="center">
<tbody>
<tr>
<td height="24"><a class="green-mb">Oracle的数据统计实例</a></td></tr>
<tr>
<td class="black-s" height="24">Tags: <a class="blue-xl" href="http://club.techtarget.com.cn/community/showBlogByTag.html?tagId=750" target="_self">database</a>  <a class="blue-xl" href="http://club.techtarget.com.cn/community/showBlogByTag.html?tagId=702" target="_self">oracle</a>  </td></tr>
<tr>
<td class="td" height="30"><a class="f1">
<p> </p>
<p>  <b>问:现在也有个数据统计的问题困绕着我。见如下数据,我要得到的是encode在哪几天里没有销售,求SQL语句,要考虑性能问题(表里有几百万条记录,而且每天都在增长)。</b></p>
<p>  有如下的数据</p>
<p>
<table cellspacing="0" cellpadding="6" width="95%" align="center" border="0">
<tbody>
<tr>
<td bgcolor="#f3f3f3"><font face="Verdana">sdate     encode   count<br />--------  -------- ------<br />2006-1-1  1001     5<br />2006-1-1  1002     11<br />2006-1-2  1002     7<br />2006-1-2  1003     1<br />2006-1-3  1003     5<br />2006-1-3  1003     21<br />2006-1-4  1001     18<br />2006-1-4  1002     10</font></td></tr></tbody></table></p>
<p>  现在想要得到如下形式的数据</p>
<p>
<table cellspacing="0" cellpadding="6" width="95%" align="center" border="0">
<tbody>
<tr>
<td bgcolor="#f3f3f3"><font face="Verdana">sdate     encode<br />--------  -------<br />2006-1-2  1001<br />2006-1-3  1001<br />2006-1-3  1002</font></td></tr></tbody></table></p>
<p>   你可以尝试用以下的方法进行调试:  </p>
<p>
<table cellspacing="0" cellpadding="6" width="95%" align="center" border="0">
<tbody>
<tr>
<td bgcolor="#f3f3f3">
<p><font face="Verdana">create table t(sdate varchar2(10),encode numeric,count numeric)<br />insert into t values('2006-1-1',1001,5 )<br />insert into t values('2006-1-1',1002,11)<br />insert into t values('2006-1-2',1002,7 )<br />insert into t values('2006-1-2',1003,1 )<br />insert into t values('2006-1-3',1003,5 )<br />insert into t values('2006-1-3',1003,21)<br />insert into t values('2006-1-4',1001,1<br />insert into t values('2006-1-4',1002,10)</font></p>
<p><font face="Verdana">select <br />    a.sdate,b.encode<br />from <br />    (select distinct sdate  from t) a,<br />    (select distinct encode from t) b<br />where<br />    not exists(select * from t where sdate=a.sdate and encode=b.encode)<br />order by<br />    b.encode,a.sdate<br /></font></p></td></tr></tbody></table></p>
<p> </p></a></td></tr></tbody></table></p>
<p>
<table cellspacing="</a">
</p></a>

Collapse -

test

by liujun In reply to liujun

<p>test</p>

Back to After Hours Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums