MySQL:如何从表中获取指定值的某些列?

I have 2 tables called learning_plan and tbl_user.I want to do this:

$qry=Query("SELECT user_name,user_family,coach_code FROM tbl_user WHERE user_level=2");
    while($result=mysql_fetch_array($qry))
     {
       $qry1=Query("SELECT * FROM learning_plan WHERE coach_code=".$result['coach_code']);
         while($result1=mysql_fetch_array($qry1))
           {

           }
     }

So I want a query in second while which can get columns with these values (!=1 and <5)

Thank u so much

why dont you use just one query with JOIN :?

 SELECT user_name,user_family,coach_code,t2.* 
 FROM tbl_user t1
 INNER JOIN learning_plan t2 ON t2.coach_code = t1.coach_code 
 WHERE t1.user_level=2