RE: [PHP-DB] SELECT giving too much :)
Hi Beau-- Alternatively you could probably include an AND for the location ID to link up with whatever it is supposed to link up to in the WHERE clause. But I have no idea how you responded to my message in 2 minutes flat! Are you a remarkably complex AI autoresponder that knocks the socks off of ELIZA (or whatever it was) style programs? Dang! 2 minutes! Good job . Doug At 12:33 PM 8/30/01 +0800, Beau Lebens wrote: >Actually yes I do :) >thanks for that - it fixes it when i remove the "FROM locations" >although I didn't want to have to pull it, because it is going to mean some >ugly testing and stuff that I wanted to avoid - oh well, looks like I have >no choice now :) > >Cheers > >beau [--snip--] --Doug's Signature File ~ ~ ~ I'm proud to work for GLISnet, Michigan's best ISP ~ ~ ~ --1.888.445.4763---8am to 8pm every day---http://www.glis.net-- The views and opinions expressed in this email are my own and may not be those of my employer. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] SELECT giving too much :)
Actually yes I do :) thanks for that - it fixes it when i remove the "FROM locations" although I didn't want to have to pull it, because it is going to mean some ugly testing and stuff that I wanted to avoid - oh well, looks like I have no choice now :) Cheers beau // -Original Message- // From: Doug Semig [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 30 August 2001 12:31 PM // To: [EMAIL PROTECTED] // Subject: Re: [PHP-DB] SELECT giving too much :) // // // Hi Beau-- // // This is just a wild guess (I've only glanced at your SQL), // but do you have // two locations in your locations table? // // You might want to try yanking locations out of the join // since you're not // using it in your WHERE clause or showing any info from it. // // Doug // // At 12:06 PM 8/30/01 +0800, Beau Lebens wrote: // >Hi guys, I have a set-up to query a database by allowing // the user to build a // >query from selecting fields, restrictions etc etc. // > // >It produces the following; // > // >SELECT students.fname, courses.title AS course FROM // students, courses, // >course_enrolments, groups, locations, staff WHERE // >(students.studentID=course_enrolments.studentID AND // >course_enrolments.courseID=courses.courseID) AND // >(students.groupID=groups.groupID) AND // (staff.staffID=courses.staffID) ORDER // >BY fname ASC //[--snip--] // // --Doug's Signature File // ~ ~ ~ I'm proud to work for GLISnet, Michigan's best ISP ~ ~ ~ // --1.888.445.4763---8am to 8pm every day---http://www.glis.net-- // The views and opinions expressed in this email are my // own and may not be those of my employer. // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, e-mail: [EMAIL PROTECTED] // For additional commands, e-mail: [EMAIL PROTECTED] // To contact the list administrators, e-mail: // [EMAIL PROTECTED] // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] SELECT giving too much :)
Hi Beau-- This is just a wild guess (I've only glanced at your SQL), but do you have two locations in your locations table? You might want to try yanking locations out of the join since you're not using it in your WHERE clause or showing any info from it. Doug At 12:06 PM 8/30/01 +0800, Beau Lebens wrote: >Hi guys, I have a set-up to query a database by allowing the user to build a >query from selecting fields, restrictions etc etc. > >It produces the following; > >SELECT students.fname, courses.title AS course FROM students, courses, >course_enrolments, groups, locations, staff WHERE >(students.studentID=course_enrolments.studentID AND >course_enrolments.courseID=courses.courseID) AND >(students.groupID=groups.groupID) AND (staff.staffID=courses.staffID) ORDER >BY fname ASC [--snip--] --Doug's Signature File ~ ~ ~ I'm proud to work for GLISnet, Michigan's best ISP ~ ~ ~ --1.888.445.4763---8am to 8pm every day---http://www.glis.net-- The views and opinions expressed in this email are my own and may not be those of my employer. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] SELECT giving too much :)
Hi guys, I have a set-up to query a database by allowing the user to build a query from selecting fields, restrictions etc etc. It produces the following; SELECT students.fname, courses.title AS course FROM students, courses, course_enrolments, groups, locations, staff WHERE (students.studentID=course_enrolments.studentID AND course_enrolments.courseID=courses.courseID) AND (students.groupID=groups.groupID) AND (staff.staffID=courses.staffID) ORDER BY fname ASC which gets the right results, but it returns something like this; +---+--+ | fname | course | +---+--+ | Beau | Graduate Certificate in Learning Technologies (K-12) | | Beau | Graduate Certificate in Learning Technologies (K-12) | | Grant | Short Course in Learning Technologies (K-12) | | Grant | Short Course in Learning Technologies (K-12) | +---+--+ and it should only be returning one of each of those records any suggestions? thanks Beau -- Beau F Lebens, Technical Officer National Key Centre for School Science and Mathematics Science and Mathematics Education Centre Curtin University of Technology, GPO Box U1987 Perth, Western Australia 6845 t: +61 8 9266 7297 (has voice-mail) f: +61 8 9266-2503 (ATT: Beau Lebens) e: [EMAIL PROTECTED] w: http://learnt.smec.curtin.edu.au/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]