Note that there are some explanatory texts on larger screens.

plurals
  1. POFaster MySQL Join for DISTINCT records
    primarykey
    data
    text
    <p>After reviewing the related questions, none of them seem to address mine, so here goes:</p> <p>I have two tables containing Course information. One table [course] holds, currently, nearly 25k records with fields such as CourseName, CourseCode, Term, Instructor, etc. The second table [courseCatalog] holds merely the CourseCode and CourseName. </p> <p>My application allows users to pull up an instructor and approve the courses from a list that they are allowed to teach.</p> <p>I built a search with auto-suggest (jQuery Ajax Object -> PHP file -> MySQL and back) to find courses. When they are returned the user can click the course to mark (Another Ajax call to PHP &amp; MySQL) it as an approved course for the instructor.</p> <p>The problem is, there are some courses in the larger table that are not in the smaller table, and vice versa (eliminating that problem is a much harder issue based on where the data actually comes from, i digress)</p> <p>If I join the tables on any particular field, certain courses are left out. LEFT JOIN still seems to yield the same problem because I'm forced to JOIN ON a field.</p> <p>If I simply call to both tables:</p> <pre><code>SELECT DISTINCT course.CourseCode, course.CourseName FROM course, courseCatalog </code></pre> <p>The query takes FOREVER which renders the search function useless, as it takes to long to load the suggestions.</p> <p>I'd like to get a DISTINCT list of courses, in order, whether they appear in the 'course' table or the 'courseCatalog' table...with great haste :)</p> <p>Any suggestions? Have I overlooked something simple? Thanks all</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload