Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Duplicate Data and Formating Results

Status
Not open for further replies.

nqaul

Programmer
Nov 15, 2004
2
IE
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top