怎样对Access里进行两个表的联合查询?

Select Case TmaterialCatalog
    
Case "Sub"
        Field
="countryID"
        sql
="Select Name From TCountry Where ID=" &SubID& ""
    
Case "Sub0"
        Field
="schoolID"
        sql
="(Select Name From TCountry Where ID=(Select countryID From TSchool Where ID=" &SubID& "))+'-'+(Select Name From TSchool Where ID=" &SubID& ")"
'        Response.Write sql
'
        Response.End 
    Case Else
        Response.Write 
"<body bgColor='#D4D0C8'></body>"
        Response.End 
End Select
有错,这是为什么呢?
为了使开发进度加快,我只好用下面的代码:
Dim Field,sql,strsql
Select Case TmaterialCatalog
    
Case "Sub"
        Field
="countryID"
        sql
="Select Name From TCountry Where ID=" &SubID& ""
    
Case "Sub0"
        Field
="schoolID"
        strsql
="Select Name From TCountry Where ID in (Select countryID From TSchool Where ID=" &SubID& ")"
        sql
="Select Name From TSchool Where ID=" &SubID& ""
        
'sql="Select (Select Name From TCountry Where ID=(Select countryID From TSchool Where ID=" &SubID& "))+'-'+(Select Name From TSchool Where ID=" &SubID& ")"
'
        Response.Write sql
'
        Response.End 
    Case Else
        Response.Write 
"<body bgColor='#D4D0C8'></body>"
        Response.End 
End Select
不知道,谁能帮助我一下,把Case "Sub0" 下面代码改下?
posted @ 2007-03-22 09:34  nuxgod  阅读(2796)  评论(1编辑  收藏  举报