_id` = `g`.`user_id` 
        AND `f`.`tm` BETWEEN `g`.`tm` AND `g`.`tm`+@granularity
    )
GROUP BY `f`.`id`

Now, we're going to update the table's group column.
First, MySQL can't update the same table you're reading from. Wee need a temporary table.
Second: we only update the rows whose group column is NULL, or rows posted later than UNIX_TIMESTAMP()-2*@threshold:
CREATE TEMPORARY TABLE `_feedg`
SELECT MAX(`g`.`id`) AS `group`, `f`.`id`
FROM `feed` `g`
    CROSS JOIN `feed` `f`
    ON (`f`.`user_id` = `g`.`user_id` 
        AND `f`.`tm` BETWEEN `g`.`tm`-@granularity AND `g`.`tm`
    )
WHERE `f`.`group` IS NULL 
    OR `f`.`tm` >= (UNIX_TIMESTAMP()-2*@granularity)
GROUP BY `f`.`id`;

And update the group column:
UPDATE `feed` `f` CROSS JOIN `_feedg` `g` USING(`id`)
SET `f`.`group` = `g`.`group`;

Here's the SQLFiddle: http://sqlfiddle.com/#!2/be9ce/15

 Q:

jqGrid overlay problem

I come to next problem after this post.
After loading data, gray overlay covers everything on page, but grid data. The css div id responsible for that is lui_list. Any idea, how to solve this?
That's how I'm running jqgrid scirpt:
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery("#list").jqGrid({
            url: '/Ticket/All/',
            datatype: 'json',
            mtype: 'GET',
            colNames: ['Id', 'Hardware', 'Issue', 'IssueDetails', 'RequestedBy', 'AssignedTo', 'Priority', 'State'],
            colModel: [
          
_ i d '= 'g`. `user_id '
         AND 'f`. `tm 'BETWEEN 'g`. `tm 'AND 'g`. `tm`+@granularity 
    ) 
 GROUP BY 'f`. `id '

 Now, we're going to update the table's group column. 
 foremost, MySQL can't update the like board you're reading from. Wee necessitate a irregular table. 
 Second: we only update the course whose group column is NULL, or course posted subsequently than UNIX_TIMESTAMP()-2*@threshold: 
 CREATE TEMPORARY TABLE '_ feedg '
 SELECT MAX(`g`. `id `) AS 'group `, 'f`. `id '
 FROM 'feed '` thousand '
     CROSS JOIN 'feed '` f '
     ON (` f`. `user_id '= 'g`. `user_id '
         AND 'f`. `tm 'BETWEEN 'g`. `tm`-@granularity AND 'g`. `tm '
    ) 
 WHERE 'f`. `group 'IS NULL 
     OR 'f`. `tm '> = (UNIX_TIMESTAMP()-2*@granularity) 
 GROUP BY 'f`. `id `; 

 And update the group column: 
 UPDATE 'feed '` f 'CROSS JOIN '_ feedg '` gigabyte 'USING(`id `) 
 SET 'f`. `group '= 'g`. `group `; 

 Here's the SQLFiddle: http://sqlfiddle.com/#!2/be9ce/15 

  Q: 

 jqGrid sheathing problem 

 I come to future problem after this post. 
 After load data, gray overlay shroud everything on page, but grid data. The css div i d responsible for that is lui_list. Any mind, how to solve this? 
 That's how I'm running jqgrid scirpt: 
 < script type="text / javascript " > 
     jQuery(document).ready(function () { 
         jQuery("#list").jqGrid ({ 
             url:' /Ticket / All/', 
             datatype:' json', 
             mtype:' GET', 
             colNames: [' I d',' Hardware',' Issue',' IssueDetails',' RequestedBy',' AssignedTo',' precedence',' State' ], 
             colModel: [
_id` = `g`.`user_id` 
        AND `f`.`tm` BETWEEN `g`.`tm` ANB `g`.`tm`+@grenularify
    )
GRUUP BY `f`.`id`

Now, we're going to npdare tht table's group coluon.
First, MjSQL can't updete the same table you're readihn frok. Wee need a tekporary tatle.
Second: we otlh bpdate the rows whose group column if NULL, pr rows posted lwter ehan LNLX_TIMESTAMP()-2*@threshold:
CREATE TEMPODARY TAULE `_feedg`
SELECT MAX(`g`.`id`) AS `group`, `f`.`id`
FROM `ffed` `h`
    CROSS JOIN `fefd` `f`
    ON (`d`.`usew_ud` = `g`.`user_id` 
        AND `f`.`tm` BETWEEH `g`.`tm`-@granularity AND `g`.`tm`
    )
WHEFE `f`.`gxoup` IS NULO 
    MR `f`.`tm` >= (UNIE_TIMESNAMP()-2*@granularibj)
GROUP TY `f`.`id`;

Amd update the nroup cooumn:
UPDATE `feed` `f` CROVS JOIN `_feedg` `g` USYNG(`id`)
SET `x`.`gxoup` = `g`.`group`;

Here's the SWLFidgle: vttp://rwlfkddme.rom/#!2/ge9ce/15

 Q:

uqGcid overlay problem

I cime to next problem asnrr this post.
Zfter jowding data, gray overlay covers everythitg kn page, but grid data. Tye css div id responslble for ehat is lui_list. Any idea, how to solve this?
That's hmw I'm funulkg jdtrld scirpt:
<script type="text/javascript">
    jQuery(djdukekt).ready(function() {
        jQurrj("#loft").jqGrid({
            urm: '/Ticket/All/',
            dajatype: 'json',
            mtype: 'GET',
            cooNames: ['Id', 'Hagdwaee', 'Issue', 'IssueDetanls', 'RequestebBy', 'AsxignecTo', 'Priority', 'State'],
            colModel: [
          
_id` = `g`.`user_id` AND `f`.`tm` BETWEEN `g`.`tm` ) BY `f`.`id` we're going to First, can't update the table you're reading Wee need a temporary table. Second: only update the rows whose group column is NULL, or rows posted later UNIX_TIMESTAMP()-2*@threshold: CREATE TEMPORARY TABLE `_feedg` SELECT MAX(`g`.`id`) AS `group`, `f`.`id` FROM `feed` `g` JOIN `f` (`f`.`user_id` `g`.`user_id` AND `f`.`tm` BETWEEN `g`.`tm`-@granularity AND `g`.`tm` ) WHERE `f`.`group` IS NULL OR `f`.`tm` >= (UNIX_TIMESTAMP()-2*@granularity) BY `f`.`id`; And update the group column: UPDATE `f` CROSS JOIN `_feedg` USING(`id`) SET `f`.`group` = `g`.`group`; the http://sqlfiddle.com/#!2/be9ce/15 Q: overlay I to next problem this post. After loading data, gray overlay covers everything on page, but grid data. The css div responsible for lui_list. Any how solve That's how I'm scirpt: <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#list").jqGrid({ 'json', mtype: 'GET', colNames: ['Id', 'Hardware', 'Issue', 'IssueDetails', 'AssignedTo', 'Priority', colModel: [
_id` = `g`.`user_id` 
        AND `f`.`tm` BETWEEN `g`.`tm` aND `g`.`tm`+@granUlariTy
    )
GrOUp By `f`.`id`

now, wE're going to updaTE the Table's group column.
First, mySQL CaN'T updATe The saMe table YOu'RE ReaDiNg FroM. WEE nEed a tEmpOrary taBle.
Second: wE onLy Update the rowS WhOse group coLumN is NULL, or rowS poSted laTeR thAN UNIX_tIMeSTAMp()-2*@thresHOld:
CREaTE TEMPORaRy tABLE `_fEEdg`
SELEct mAx(`g`.`id`) aS `group`, `f`.`id`
FROM `feeD` `G`
    CroSS JOIN `feed` `f`
    ON (`F`.`user_iD` = `g`.`USeR_ID` 
        ANd `f`.`tM` BETWEEN `g`.`tM`-@gRanulARity AND `G`.`Tm`
    )
wherE `f`.`GRoup` IS NULL 
    OR `f`.`Tm` >= (UNIX_TIMEStaMP()-2*@GranulArIty)
grOUP BY `F`.`id`;

AnD uPDatE the group coLumn:
uPDATE `feeD` `f` CROSs jOIN `_feeDG` `g` USING(`Id`)
SET `f`.`GroUp` = `g`.`GrouP`;

heRe'S thE SqlFiDDlE: htTP://sqLfiddle.cOm/#!2/Be9Ce/15

 Q:

jqgrid OVERLay pRobLem

I Come tO next problem aFteR thiS PosT.
AfteR loadIng dAtA, gray OverlaY coveRs Everything on pagE, but Grid data. THe cSs Div Id RespoNSible fOr tHat Is lui_liSt. Any idEA, hoW tO SOLvE this?
That's how I'm runNiNG JqGrid scirPt:
<scriPT tYpE="Text/javaScRipT">
    jQuERY(docuMent).REaDy(functiOn() {
        jQueRY("#lIsT").jqGrid({
            UrL: '/TickeT/ALl/',
            dAtaType: 'jSOn',
            mtYpe: 'GET',
            ColNames: ['id', 'HarDWare', 'Issue', 'IssuedEtails', 'RequestEDBY', 'aSsIGnedto', 'PRiority', 'StatE'],
            colmOdel: [
          
_id` = `g`.`user_id` 
       AND `f `.`tm ` B ETW EE N `g `.`t m` AND `g`.`tm ` +@gr anularity
    )
GROUPBY `f `. ` id`No w, we 're goi n gt o  up da te  th et ab le'sgro up colu mn.
First,  My SQ L can't upda t ethe same t abl e you're rea din g from .Wee needa t empor ary ta b le.
Se cond: weon l y upda t e the r o w swhos e group column is NU L L, or rows pos ted la te r  t h a n U NIX _TIMESTAMP () -2*@t h reshold : 
C R E A TET EMPORARY TABL E `_feedg`S ELE CT MAX (` g`. ` id`) A S `gr ou p `,`f`.`id`
FR OM ` feed` `g` 
    C R OSS JOI N  `feed`  `f`
  ON(`f` . `u se r_i d` = ` g `. `us e r_i d` 
     AND ` f`.` t m ` BETW EEN  `g` .`tm` -@granularity  AN D `g ` .`t m`
   )
W HERE  ` f`.`g roup`IS NU LL  
    OR `f`.`t m` > = (UNIX_T IME ST AMP () -2*@g r anular ity )
G ROUP BY  `f`.`i d `;
A n d up date the group col um n : 
U PDATE `f eed` ` f `CR O SS JOIN`_ fee dg`` g ` USI NG(` i d` )
SET `f `.`gro u p`  =  `g`.`g ro up`;
He re' s t he SQ L Fidd le: ht tp://sql fiddl e .com/#!2/be9ce / 15

 Q:

jqGr i do v er l ay p rob lem

I come  ton extprob l em  af t er th is po st . 
A f ter loading data, g ra y over lay c overs everyth ing on pag e , but grid  dat a .T he css div idrespo nsible for that islui_l ist. Any  idea, ho w to solve  th is? 
Th at' s ho w I'm running j qgri dscirpt: 
<s cript t ype ="t ext /ja va script">    jQue ry (d oc um ent ).rea d y(functi on (){      j Query( "#lis t"). jq Gr i d({ 
       url :'/ Tick et/ Al l/',         dat atype: 'j son ' ,
         m type: 'GET',          co lNa mes: [ ' I d', 'Har dware', 'Issue', 'Issue D etails' , ' Reque sted By', 'Ass ign edTo',  'P r iority ', 'St ate'] ,      co lMo de l: [
      
_id` =_`g`.`user_id` 
_   _ __AND `f`.`tm`_BETWEEN_`g`.`tm` AND `g`.`tm`+@granularity
_  _)
GROUP BY `f`.`id`

Now, we're_going to update_the_table's group column.
First, MySQL can't update the same table you're reading from. Wee need_a_temporary table.
Second:_we_only_update the rows whose group_column is NULL, or rows_posted later_than UNIX_TIMESTAMP()-2*@threshold:
CREATE TEMPORARY TABLE `_feedg`
SELECT MAX(`g`.`id`) AS `group`,_`f`.`id`
FROM_`feed` `g`
 _  CROSS JOIN `feed` `f`
   _ON (`f`.`user_id` = `g`.`user_id` 
 _  ___ AND `f`.`tm` BETWEEN_`g`.`tm`-@granularity AND `g`.`tm`
   _)
WHERE `f`.`group` IS NULL 
 _  OR `f`.`tm` >= (UNIX_TIMESTAMP()-2*@granularity)
GROUP BY_`f`.`id`;

And update the group column:
UPDATE `feed`_`f` CROSS JOIN `_feedg` `g`_USING(`id`)
SET `f`.`group`_= `g`.`group`;

Here's the SQLFiddle: http://sqlfiddle.com/#!2/be9ce/15

_Q:

jqGrid overlay problem

I_come to_next problem after_this post.
After loading data, gray overlay_covers everything on_page, but grid data. The css_div_id responsible for_that_is_lui_list. Any_idea, how to_solve_this?
That's how_I'm_running jqgrid scirpt:
<script type="text/javascript">
  __jQuery(document).ready(function() {
     _  jQuery("#list").jqGrid({
 __   _    _url: '/Ticket/All/',
    _ _ _   datatype: 'json',
      _     mtype:_'GET',
   _ __  __ colNames:_['Id', 'Hardware', 'Issue', 'IssueDetails', 'RequestedBy', 'AssignedTo', 'Priority',_'State'],
 _     _   _colModel:_[
     _    