有如下表:pos code 
1   a
1   b
1   c
2   e
2   f
3   g
3   h要得到如下结果,类似与迪卡尔积。a  e  g
b  e  g
c  e  g
a  f  g
b  f  g
c  f  g
......就是要把三个POS下的值以迪卡尔积方式列出,大家帮忙,谢谢啦。

解决方案 »

  1.   

    select a.code, b.code, c.code from 
    (select * from tbl where pos=1) a, 
    (select * from tbl where pos=2) b, 
    (select * from tbl where pos=3) c
      

  2.   

    回复人: weizi2000(秋风啊) ( ) 信誉:100  2004-04-19 14:59:00  得分:0 
     
     
      select a.code, b.code, c.code from 
    (select * from tbl where pos=1) a, 
    (select * from tbl where pos=2) b, 
    (select * from tbl where pos=3) c
     
     GOOD !!!!!!!!!!!1
      

  3.   

    weizi2000(秋风啊)厉害,手脚好快啊!
    建议楼主给分.