here the df(i updated by real data ):

```
>TIMESTAMP          OLTPSOURCE      RNR                         RQDRECORD
>20150425232836     0PU_IS_PS_44    REQU_51NHAJUV06IMMP16BVE572JM2  17020
>20150128165726     ZFI_DS41        REQU_50P1AABLYXE86KYE3O6EY390M  6925
>20150701144253     ZZZJB_TEXT      REQU_52DV5FB812JCDXDVIV9P35DGM  2
>20150107201358     0EQUIPMENT_ATTR     REQU_50EVHXSDOITYUQLP4L8UXOBT6  14205
>20150623215202     0CO_OM_CCA_1     REQU_528XSXYWTK6FSJXDQY2ROQQ4Q 0
>20150715144139     0HRPOSITION_TEXT    REQU_52I9KQ1LN4ZWTNIP0N1R68NDY  25381
>20150625175157     0HR_PA_0    REQU_528ZS1RFN0N3Y3AEB48UDCUKQ  100020
>20150309153828     0HR_PA_0    REQU_51385K5F3AGGFVCGHU997QF9M  0
>20150626185531     0FI_AA_001  REQU_52BO3RJCOG4JGHEIIZMJP9V4A  0
>20150307222336     0FUNCT_LOC_ATTR REQU_513JJ6I6ER5ZVW5CAJMVSKAJQ  13889
>20150630163419     0WBS_ELEMT_ATTR REQU_52CUPVUFCY2DDOG6SPQ1XOYQ2  0
>20150424162226     6DB_V_DGP_EXPORTDATA    REQU_51N1F5ZC8G3LW68E4TFXRGH9I  0
>20150617143720     ZRZMS_TEXT  REQU_5268R1YE6G1U7HUK971LX1FPM  6
>20150405162213     0HR_PA_0    REQU_51FFR7T4YQ2F766PFY0W9WUDM  0
>20150202165933     ZFI_DS41    REQU_50QPTCF0VPGLBYM9MGFXMWHGM  6925
>20150102162140     0HR_PA_0    REQU_50CNUT7I9OXH2WSNLC4WTUZ7U  0
>20150417184916     0FI_AA_004  REQU_51KFWWT6PPTI5X44D3MWD7CYU  0
>20150416220451     0FUNCT_LOC_ATTR REQU_51JP3BDCD6TUOBL2GK9ZE35UU  13889
>20150205150633     ZHR_DS09    REQU_50RFRYRADMA9QXB1PW4PRF5XM  6667
>20150419230724     0PU_IS_PS_44    REQU_51LC5XX6VWEERAVHEFJ9K5A6I  22528

>and the relationships between columns is
>OLTPSOURCE--RNR:1>n
>RNR--RQDRECORD:1>N

```

> 
> and my requirement is:
> 
> 
> 

1. sum the RQDRECORD by RNR;
2. get the max sum result of every OLTPSOURCE;
3. Finally, I would draw a graph showing the results of all
sumed largest OLTPSOURCE by time

Thanks everyone, I further explain my problem:

1. if OLTPSOURCE:RNR:RQDRECORD= 1:1:1

> 
> just sum RQDRECORD,RETURN OLTPSOURCE AND SUM RESULT
> 
> 
>
2. if OLTPSOURCE:RNR:RQDRECORD= 1:1:N

> 
> just sum RQDRECORD,RETURN OLTPSOURCE AND SUM RESULT
> 
> 
>
3. if OLTPSOURCE:RNR:RQDRECORD= 1:N:(N OR 1)

> 
> sum RQDRECORD by RNR GROUP first,THEN Find the max result of one OLTPSOURCE,return all the OLTPSOURCE with the max RQDRECORD .
> 
> 
>

So for the above sample data, I eventually want the result as follows

```
>TIMESTAMP  OLTPSOURCE  RNR RQDRECORD
>20150623215202     0CO_OM_CCA_1    REQU_528XSXYWTK6FSJXDQY2ROQQ4Q  0
>20150107201358     0EQUIPMENT_ATTR REQU_50EVHXSDOITYUQLP4L8UXOBT6  14205
>20150626185531     0FI_AA_001  REQU_52BO3RJCOG4JGHEIIZMJP9V4A  0
>20150417184916     0FI_AA_004  REQU_51KFWWT6PPTI5X44D3MWD7CYU  0
>20150416220451     0FUNCT_LOC_ATTR REQU_51JP3BDCD6TUOBL2GK9ZE35UU  13889
>20150625175157     0HR_PA_0    REQU_528ZS1RFN0N3Y3AEB48UDCUKQ  100020
>20150715144139     0HRPOSITION_TEXT    REQU_52I9KQ1LN4ZWTNIP0N1R68NDY  25381
>20150419230724     0PU_IS_PS_44    REQU_51LC5XX6VWEERAVHEFJ9K5A6I  22528
>20150630163419     0WBS_ELEMT_ATTR REQU_52CUPVUFCY2DDOG6SPQ1XOYQ2  0
>20150424162226     6DB_V_DGP_EXPORTDATA    REQU_51N1F5ZC8G3LW68E4TFXRGH9I  0
>20150202165933     ZFI_DS41    REQU_50QPTCF0VPGLBYM9MGFXMWHGM  6925
>20150205150633     ZHR_DS09    REQU_50RFRYRADMA9QXB1PW4PRF5XM  6667
>20150617143720     ZRZMS_TEXT  REQU_5268R1YE6G1U7HUK971LX1FPM  6
>20150701144253     ZZZJB_TEXT  REQU_52DV5FB812JCDXDVIV9P35DGM  2

```

Referring to EdChum's approach, I made some adjustments, the results were as follows, because the amount of data is too big, I did "'RQDRECORD> 100000'" is set, in fact I would like to sort and then take the top 100, but not success

> 
> [1]: <http://i.imgur.com/FgfZaDY.jpg> "result"
> 
> 
>
['https://Stackoverflow.com/questions/31581537', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5146939/']
Peter, we've just implemented the same thing.

Users have the software pre-installed on their device and we host update APK's on the companies servers.

From the app they can then check for updates where we have a WCF service which extracts the APK file (essentially a .zip) and returns the manifest details. From there we have the version of the APK and can compare it against the local version.

If the user decides to upgrade they can download the APK and you can automatically launch it. At which point the user will be told the application is going to be updated. There are no file locks etc, the app will just close and restart using the new version.

Note: Downgrading is not "automatic". The user would have to first uninstall the app. For upgrades, however, it's a simple case of downloading and launching the APK version (the user will be told they need to allow installations from unknown sources if this is not checked).
You have a couple of options, depending upon your target system.

1. Use the link you posted. This will provide the user with a traditional install dialog, whereby the user can choose to install or not. You should avoid doing that automatically, as APKs can be large and you might irritate the user if they don't want updates.
2. You can install updates magically, but you will require the firmware signing key (or possibly root, but I haven't tested that). That will not ask for consent from the user. You will need to add additional code using reflection to access the installation methods of Android. If you go this way, you should build an opt-out/in mechanism.