Hi,
I have several queries each returning
results with duplicated data, such as this:
staff_id date hours duty
1 1/1/04 8-5 C
2 1/1/04 9-6 W
1 2/1/04 9-4 C
2 2/1/04 8-5 W
3 2/1/04 8-5 C
And so on for each week day.
The tables are as follows:
rosters (rid, wknum, startdate,enddate)
date (dateid, date)
staffday (dateid, rosterid, staffid, hours, duty)
staffcontract (staffid, stafftype)
staff (staffid, name)
What I want at the end on screen is:
ID DATE1 DATE2........ DATE6 DATE7
1 8-5 9-4 8-3 9-6
2 9-6 8-5 7-2 6-2
3 OFF 8-5 8-3 9-6
My question is how do I group/order/sort the results in mysql so that i don'
t have duplication in the returned data as above. I want to avoid complicat
ed if/then/else in my php when building the output table.
Thanks in advance, but help please!!!!
nqaul
I have several queries each returning
results with duplicated data, such as this:
staff_id date hours duty
1 1/1/04 8-5 C
2 1/1/04 9-6 W
1 2/1/04 9-4 C
2 2/1/04 8-5 W
3 2/1/04 8-5 C
And so on for each week day.
The tables are as follows:
rosters (rid, wknum, startdate,enddate)
date (dateid, date)
staffday (dateid, rosterid, staffid, hours, duty)
staffcontract (staffid, stafftype)
staff (staffid, name)
What I want at the end on screen is:
ID DATE1 DATE2........ DATE6 DATE7
1 8-5 9-4 8-3 9-6
2 9-6 8-5 7-2 6-2
3 OFF 8-5 8-3 9-6
My question is how do I group/order/sort the results in mysql so that i don'
t have duplication in the returned data as above. I want to avoid complicat
ed if/then/else in my php when building the output table.
Thanks in advance, but help please!!!!
nqaul