SQL query (OT)

From: Date: Tue, 21 Aug 2001 22:08:14 +0000
Subject: SQL query (OT)
Groups: php.db 
Request: Send a blank email to php-db+get-11632@lists.php.net to get a copy of this message
hi: I have 2 tables, lesson and lesson_gle, where lesson holds lesson data and lesson_gle holds repeating data that are how the lesson correlates to various state standards (one lesson can have many correlations)...one particular lesson may have a math correlation as well as a language arts correlation. From a couple of popups, I am passing numerical values for $level and $subject which pertain to a certain level (grade level) and subject (the correlations). I am decoding them using an array which I use to construct the query you see below. The query is working fine, HOWEVER, it only looks at the first correlation of a lesson...so if I ask for math, all of the lessons that have math as a second correlation are not returned, and I would like to be able to show ALL lessons that have a "MA" correlation. SELECT * FROM lesson, lesson_gle WHERE lesson.l_id = lesson_gle.l_id $cluster[$level] GROUP BY lesson.l_id HAVING lesson_gle.glenum LIKE '$subjaray[$subject]%' ORDER BY lesson.l_id $cluster = array (" ", "AND (lesson.grdlevel = '1' OR lesson.grdlevel = '2')", "AND (lesson.grdlevel = '3' OR lesson.grdlevel = '4' OR lesson.grdlevel = '5')", "AND (lesson.grdlevel = '6' OR lesson.grdlevel = '7' OR lesson.grdlevel = '8')", "AND (lesson.grdlevel = '9' OR lesson.grdlevel = '10' OR lesson.grdlevel = '11' or lesson.grdlevel = '12')"); $subjaray = array ("", "LA", "MA", "SS", "SC", "AT", "VA", "PE", "TH", "MU", "HE", "DA", "FL"); Thanks Luis __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/

« previous php.db (#11632) next »