View Single Post
  #2  
Old 04-08-2010, 09:56 PM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 16,018
Seapyramid
Default RE: Join query for optimization?

The query is wrong. You are selecting from multiple tables.. but not telling it what to look for in what table.
FROM ".$prefix."owned_adoptables AS a JOIN
PHP Code:
SELECT *                                                                       
FROM adopts_adoptables AS a JOIN adopts_owned_adoptables AS b ON  a.aid=b.aid 
JOIN adopts_levels  
AS c ON a.aid=c.aid           
WHERE  
`a.aid` = 144 AND                            
`
a.type` = `adopts_adoptables`.`type` AND          
(`
adopts_levels`.`adoptiename` = `adopts_adoptables`.`type` OR                
`
adopts_owned_adoptables`.`currentlevel` = 0) AND                       
(`
adopts_owned_adoptables`.`currentlevel` = `adopts_levels`.`thisislevel`
 OR `
adopts_owned_adoptables`.`currentlevel` = 0)                            
LIMIT 1 
This isn't fully complete.. but you can see my changes & work with the pattern on what the WHERE is.

Sea
Reply With Quote