主界面输入一个参数,接着从几个表中去出与之相对应的一条纪录,并把这条纪录的相关子段显示在界面的txtbox
大家等等
我在写这个查询的语句

解决方案 »

  1.   

    还有个问题
    我的参数全方到一个参数表中
    查询数据的时候就比较麻烦
    例如TableA中有两个字段TA1(方式),TA2(样式)
                                1        2                 
    参数表Parameter 
        pA1     pA2      pA3
        方式    1        方式1
        方式    2        方式2
        样式    1        样式1
        样式    2        样式2 
     
    我想得到的结果是     TA1(方式),TA2(样式)
                          方式1       样式2  我写的查询语句是
        select 方式,样式
        from  TableA inner join 
        (select PA3 as 方式,pA2 as code from parameter where pA1='方式') b
        on TableA.TA1=b.code inner join
        select PA3 as 样式,pA2 as code1 from parameter where pA1='样式') c
        on TableA.TA2=c.code1 
    我这么写可以得到结果
    我觉得是否太麻烦了
    如果参数多了怎么班
    大家看看还有什么好的方法
      

  2.   

    small_pig715(small_pig715
    用临时表应该可以把
      

  3.   

    如果是SqL Server2000 就用表值函数
      

  4.   

    Rivulet119(之江滔滔) 
    是sql server2000
      

  5.   

    small_big:
       在一个存储过程中可以点用别的存储过程
      

  6.   

    select b.pA3 方式,c.pA3 样式
        from TableA
        inner join parameter b on TableA.TA1=b.pA2 and pA1='方式'
        inner join parameter c on TableA.TA2=c.pA2 and pA1='样式'