嵌套查询语句怎样写解决思路

嵌套查询语句怎样写
要做一个查询模块,查询小学、中学的男女生考试成绩月报、年报。有三个可选条件:1.小学、中学,2.男生、女生,3.月报、年报。我写了一个,但运行报错,请帮忙解决,谢谢!
if sdszb="0.小学" then 
   if xs="0.男生" then 
       if bblx="0.月报" then 
          ls_sql =""
       elseif bblx="1.年报" then           
         ls_sql =""
       end if     
    elseif xs="1.女生" then
        if bblx="0.月报" then 
          ls_sql =" "
        elseif bblx="1.年报" then           
          ls_sql =""
        end if                    
    end if    
  elseif sdszb="1.中学" then                
     if xs="0.男生" then 
       if bblx="0.月报" then 
          ls_sql ="" 
      elseif bblx="1.年报" then           
         ls_sql =""
       end if           
    elseif xs="1.女生" then
        if bblx="0.月报" then 
          ls_sql =""
        elseif bblx="1.年报" then           
         ls_sql =""
  end if
    end if    
end if  
------解决方案--------------------
引用:
要做一个查询模块,查询小学、中学的男女生考试成绩月报、年报。有三个可选条件:1.小学、中学,2.男生、女生,3.月报、年报。我写了一个,但运行报错,请帮忙解决,谢谢!
if sdszb="0.小学" then 
  if xs="0.男生" then 
  if bblx="0.月报" then 
  ls_sql =""
  elseif bblx="1.年报" then  
  l……

能把完整的代码贴上来吗?报什么错了?