I have the following tables:
mysql> describe lawfac_pub; +------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+-------+ | hawkid | varchar(16) | | PRI | | | | emailalias | varchar(128) | YES | | NULL | | | first_name | varchar(64) | YES | | NULL | | | last_name | varchar(64) | YES | | NULL | | | title | varchar(128) | YES | | NULL | | | building | varchar(128) | YES | | BLB | | | phone | varchar(64) | YES | | NULL | | | room | varchar(255) | YES | | NULL | | | notes | varchar(255) | YES | | NULL | | +------------+--------------+------+-----+---------+-------+
mysql> describe fac_stud_lunch;
+-------------------+------------------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+------------------------+------+-----+---------------------+-------+
| instructor_hawkid | varchar(16) | | PRI | | |
| meal_time | datetime | | PRI | 0000-00-00 00:00:00 | |
| meal_type | enum('lunch','supper') | | | lunch | |
| location | varchar(128) | | | | |
| num_students | int(11) | YES | | NULL | |
+-------------------+------------------------+------+-----+---------------------+-------+
mysql> describe fac_stud_lunch_join; +-------------------+-------------+------+-----+---------------------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-------------+------+-----+---------------------+-------+ | instructor_hawkid | varchar(16) | | PRI | | | | student_hawkid | varchar(16) | | PRI | | | | meal_time | datetime | | PRI | 0000-00-00 00:00:00 | | +-------------------+-------------+------+-----+---------------------+-------+
And this is my query I run from php:
SELECT DISTINCT lawfac_pub.first_name, lawfac_pub.last_name, date_format(fac_stud_lunch.meal_time, "%W, %M %D, %Y") as formatted_date, fac_stud_lunch.meal_time AS fac_stud_lunch_meal_time, fac_stud_lunch.instructor_hawkid, fac_stud_lunch.meal_type, fac_stud_lunch.location, fac_stud_lunch.num_students
FROM lawfac_pub INNER JOIN (fac_stud_lunch INNER JOIN fac_stud_lunch_join ON fac_stud_lunch.instructor_hawkid = fac_stud_lunch_join.instructor_hawkid) ON lawfac_pub.hawkid = fac_stud_lunch_join.instructor_hawkid
WHERE (((fac_stud_lunch_join.student_hawkid) Not Like 's1')) order by fac_stud_lunch.meal_time;
And I keep getting an error on the inner join. I've usually been able to get the syntax for joining 3 or 4 tables by using Access, but it seems to have failed me this time.
Any ideas why this select statement is failing?
Thanks,
Bob
====================================================================== Bob Ramsey Applications Development & Support II ph: 1(319)335-9956 216 Boyd Law Building fax: 1(319)335-9019 University of Iowa College of Law mailto:[EMAIL PROTECTED] Iowa City, IA 52242-1113 For Hardware and Software questions, call 5-9124 ======================================================================
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php