Jump to content

how to put these 2 queries into 1?


dragon_sa

Recommended Posts

// get working staff from staff table
$staffSQL=mysql_query("SELECT * FROM staff WHERE ".$weekday." != 'off' AND onLEAVE='no' AND ACTIVE='yes' ORDER BY staffID ASC");

// get appointments for selected date from appointmen table
$existSQL=mysql_query("SELECT * FROM appointment WHERE date='$sqlDATE' AND staffID='$staffID'");

 

I currently have these 2 queries running in a script with the top one first then a while loop of results for that, then a for loop to list appointment times, then the second query with another while loop for that, the problem with that is when it finds appointments on the same day it runs lists the reults twice, so I want to merge the 2 sql queries together and use the original while loop for the result, how can I join or link these 2 queries into 1

 

the data i am pulling from each is as follows

query 1

	$name=$staff['staffNAME'];
	$avail=$staff[$weekday];
	$staffID=$staff['staffID'];

 

query 2

	$resSTART=$appointV['dateTIME'];
	$length=$appointV['totalTIME'];

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.