mysql - Update row with previous rows data -


good morning. stumped. have looked @ examples , explanation still stumped hope here can help.

here sql query.

select          calls.`date_entered`, `call_date`,`calls_contacts`.`contact_id`,days calls inner join `calls_contacts` on calls.id = `calls_contacts`.`call_id` order `calls_contacts`.`contact_id`,calls.`date_entered`; 

this returns

2014-05-25| |252525| 2014-05-27| |252525| 2014-06-03| |252525| 2014-05-15| |425254| 2014-05-15| |425254| 2014-05-17| |425254| 

i need output like

2014-05-25|2014-05-27 |252525| 2014-05-27|2014-06-03 |252525|2 2014-06-03| |252525|7 2014-05-15|2014-05-15 |425254| 2014-05-15|2014-05-17 |425254|0 2014-05-17| |425254|2 

where column 2 populated next rows column 1 date - field, , column 4 amount of days first call next call.

thanking in advance


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -