各位csdn的兄弟姐妹,可以帮我解决这个问题吗?我要求的fastreoprt如下:
报表标题:         Report
分组头:      a       b
主项数据:     c       d
其中我的主项数据是根据分组头的条件得到的,比如:
分组头的数据是这样得到:
select a,b from table1;我的主项数据是这样得到:
select c,d from table2 where table2.c=table1.a也就是说必须先得到a,以此为条件得到c,这样应该怎么做啊?

解决方案 »

  1.   

    你可以用下面的数据集查询出所有数据:
    select a.a, a.b, b.c, b.d  from table1 a, table2 b where a.a=b.c order by a.a, a.b然后分组头用数据集中的a, b字段
    主项数据用数据集中的c,d字段列
    一定可以实现你要的功能!
      

  2.   

    select x.c,x.d from table2   x left join table1 y on x.c=y.a
      

  3.   

    select x.c,x.d from table2   x left join table1 y on x.c=y.aleft 改为inner
      

  4.   

    谢谢这两位大哥,还有一个问题:select a  from table1  where a>20        ---作为分组头数据以此为条件select a,b from table1  where  c=a           
       ---作为主项数据,请注意这里的条件a是从上一个select语句中得到的也就是说我要得到的数据是:
    a     b       c   
    50    good    bad     
    15    well    50
    14    done    50