显示相同表格的日期差异和值 [英] To show date difference and value from same table

查看:80
本文介绍了显示相同表格的日期差异和值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有单独的日期和价值表。我想显示日期差异和价值。









I have single table with date and value. I want to show date difference and value.


Table

date |  value
-------------------------


7/24/2015		496
7/31/2015		496
8/7/2015		496
8/14/2015		496
8/21/2015		496
8/28/2015		400
9/4/2015		400
9/11/2015		400
1/29/2016		400
2/5/2016		400





输出





Output

date | Difference | value
-------------------------
7/24/2015		496
8/28/2015	96	400
9/11/2015		400







条件:

1.如果根据日期在差异栏中显示的价值有任何差异。

2.重复相同的价值不需要再次显示。

3。减少将显示另一列的差异。



我尝试过:






Condition :
1. if there is any difference in value based on date it should show in difference column.
2. Repeated same value not required to show again.
3. Decrease will show difference in another column.

What I have tried:

CREATE TABLE IF NOT EXISTS `account_str1` (
  `Date` date NOT NULL,
  `acc_no` varchar(255) NOT NULL,
  `cust_name` varchar(255) NOT NULL,
  `points` int(11) NOT NULL
)



// cdsl_res作为数组计数




// cdsl_res taken as array count

<table class="table-bordered table-striped table">
                                           <thead>
                                               <th>Date </th>
                                               <th>Transferred </th>
                                                <th>Points </th>
                                           </thead>

                                                                                        for($i=0;$i<$cdsl_res;$i++){
                                               echo '<tr>';
                                               echo '<td>'.$mydateArray[$i].'</td>';
                                               $share1 = $mypositionArray[$i];
                                               $share2 = $mypositionArray[$i-1];

                                               if($share_1 < $share_2){
                                                   $diff   = $share_2 - $share_1;
                                                   echo '<td>'.$diff.'</td>';
                                               }
                                               else{
                                                   echo '<td></td>';

                                               }

                                               echo '<td>'.$mypositionArray[$i].'</td>';

                                               echo '</tr>';
                                           }
                                           ?></table>

推荐答案

i = 0;


i <
i<


cdsl_res;
cdsl_res;


这篇关于显示相同表格的日期差异和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆