Jump to content

mySQL queary on PHP geting to much data.


nezbo

Recommended Posts

Hi

 

I have this code ::

 

		// ----------------------------- select infor from mySQL ------------------------------//
	$getInfo = mysql_query("SELECT
		person.*, 
		site.*, 
		_fullrota.*,
		_daysoftheweek.*,
		_duty.*, 
		_payrate.*,
		_weeknumber.*,
		holidayrequest.*
	FROM 
		 person, site, _fullrota, _daysoftheweek, _duty, _payrate, _weeknumber, holidayrequest 
	WHERE 
		(
		site.SiteID = _fullrota.fullLocation AND _weeknumber.weekID = _fullrota.fullWeekNumber 
		AND _payrate.payRateID = _fullrota.fullPayRate AND _duty.dutyID = _fullrota.fullDuty 
		AND person.CallID = _fullrota.fullStaffName AND _daysoftheweek.dayID = _fullrota.fullRotaDay 
		$selectedUser AND _fullrota.Other = 0 AND _fullrota.giveAway = 0 AND _fullrota.sickRequest = 0 AND trainingDays = 0 
		AND _fullrota.fullRotaID = holidayrequest.shiftID  
		)
		||
		(
		site.SiteID = _fullrota.fullLocation AND _weeknumber.weekID = _fullrota.fullWeekNumber 
		AND _payrate.payRateID = _fullrota.fullPayRate AND _duty.dutyID = _fullrota.fullDuty 
		AND person.CallID = _fullrota.fullStaffName AND _daysoftheweek.dayID = _fullrota.fullRotaDay 
		$selectedUser AND _fullrota.Other = 0 AND _fullrota.giveAway = 0 AND _fullrota.sickRequest = 0 AND trainingDays = 0 
		AND _fullrota.holidayRequest = 1 
		)
	ORDER BY 
		_fullrota.fourWeekDate ASC, _weeknumber.weekID ASC, _daysoftheweek.Priorty ASC, _fullrota.fullStartTime ASC") or die(mysql_error());
	// -----------------------------/select infor from mySQL ------------------------------//

 

The problem is that i am geting the info back that i needed muitlplied by the number of enterys in the holidayrequest table. i am not to sure if this make sence

 

i will try and explain it a bit better by an example

 

number of holiday requests = 3

 

 

Staff name  |  Date

---------------------

Steve          |  **********

Steve          |  **********

Steve          |  **********

Bert            |  *********

Bert            |  *********

Bert            |  *********

 

etc...

 

please Help....

Neil

Link to comment
Share on other sites

Doing joins can often result in data sets that have rows that appear to be duplicates.. Can you pare this down into a much simpler query and result set (say using three tables and three fields on each) to make it easier to figure out? I'm guessing nobody has replied because they see that monster query and don't want to be bothered with hacking their way through it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.