Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I'm using PHP 4 and MySQL 4. I have a table that has two columns -- DAY and SALES. Let's say the values are as such: DAY SALES --- ----- 5-29-05 15 5-31-05 5 Is there a way in MySQL to select 3 rows of data from the table where the 3rd row would be 5-30-05 0 ? I am hoping to construct a single query to do this. Any help you hvave is greatly appreciated, - Dave
Post Follow-up to this messageIt would be possible with one query if you'd add an additional table with all dates (e.g. until 2010 or so). There is an example by "santi bari" on http://dev.mysql.com/doc/mysql/en/d...functions.html. Other possibility would be to create an array with the required interval first and then fill it with the required values from mysql. Martin <laredotornado@zipmail.com> schrieb im Newsbeitrag news:1117545071.031614.165360@g14g2000cwa.googlegroups.com... > Hello, I'm using PHP 4 and MySQL 4. I have a table that has two > columns -- DAY and SALES. Let's say the values are as such: > > DAY SALES > --- ----- > 5-29-05 15 > 5-31-05 5 > > Is there a way in MySQL to select 3 rows of data from the table where > the 3rd row would be > > 5-30-05 0 > > ? I am hoping to construct a single query to do this. Any help you > hvave is greatly appreciated, - Dave >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.