tomasd Posted September 29, 2008 Share Posted September 29, 2008 Hi all, I have table tuples which contain date and decimal values. i.e. 2008-09-01 25 2008-09-07 14 2008-09-10 17 Is there any way of doing select so it outputs following; 2008-09-01 25 2008-09-02 25 2008-09-03 25 2008-09-04 25 2008-09-05 25 2008-09-06 25 2008-09-07 14 2008-09-08 14 2008-09-09 14 2008-09-10 17 thanks for your help!!! Quote Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/ Share on other sites More sharing options...
Cosizzle Posted September 29, 2008 Share Posted September 29, 2008 SELECT * FROM tableName WHERE date < '2008-09-01' is that what you're looking for? Quote Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/#findComment-653220 Share on other sites More sharing options...
fenway Posted September 29, 2008 Share Posted September 29, 2008 Tuples in the DB? Quote Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/#findComment-653352 Share on other sites More sharing options...
Barand Posted September 29, 2008 Share Posted September 29, 2008 try <?php $sql = "SELECT tupledate, num FROM tuple ORDER BY tupledate"; $res = mysql_query($sql); $prevd=$prevn=''; while (list($d, $n)=mysql_fetch_row($res)) { if ($prevd != $d) { if ($prevd != '') { $date = $prevd; while ($date < $d) { echo "$date $prevn<br/>"; $date = date('Y-m-d', strtotime ("$date +1 days")); } } $prevd = $d; $prevn = $n; } } echo "$prevd $prevn<br/>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/126324-help-needed-with-mysql-syntax/#findComment-653485 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.