Diaplaying All Dates

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
imatrox05
Forum Newbie
Posts: 16
Joined: Wed Mar 29, 2006 8:44 pm

Diaplaying All Dates

Post by imatrox05 »

Hi.

I have 2 tables 1 holding project information and the other holding jobs within the projects.

Table1: projects

Project_Id
Client
Incharge


Table2: Jobs

Project_id
Job_id
No_Units
received_date
Due_date
Status


I want to make a report that show all the dates and display jobs against due dates (Similar to showing daily usage statistics)

Example: Supposing these three records are currently in the jobs table

Code: Select all

Project_id      Job_id      No_Units       Recd_date    Due_Date
-----------------------------------------------------------
P1001          J1001          5             2006-03-20    2006-04-04
P1002          J1002          57           2006-03-26    2006-04-14
P1003          J1003          8             2006-03-29   2006-04-25
I want my report to be like this

Code: Select all

Date                    Jobs
2006-03-20          P1001-J1001
2006-03-21
2006-03-22
2006-03-23
2006-03-24        
2006-03-25
2006-03-26         P1002-J1002
2006-03-27
2006-03-28
2006-03-29         P1003-J1003
In short i want to display all the dates between the smallest and biggest due dates for the jobs whose status is not "Over"

I am new to php so i'd really appreciate any help that i can get.

Thanks in advance
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

this would normally be done with a loop in php, not with the database beyond (maybe) finding the start and end dates.
Post Reply