开发者

Represent one to many relationship on one report and get the many-table in a row instead of col

My user wants a report which rows and columns of many-table repeats in a single row until all rows of many-table are finished. what is the best way to write query for that? i hope could get what i want

______________________________________________________________________________________
|table(1)       |                table(2)                                             |
|---------------|--------------------|--------------------|------|--------------------|
|table(1) (row1)|table(2 of 1)(row 1)|table(2 of 1)(row 2)| .... |table(N of 1)(row X)|
|---------------|--------------------|--------------------|------|--------------------|
|table(1) (row2)|table(2 of 2)(row 1)|table(2 of 2)(row 2)| .... |table(N of 2)(row y)|
|---------------|--------------------|--------------------|-开发者_如何学运维-----|--------------------|
|table(1) (row3)|table(2 of 3)(row 1)|table(2 of 3)(row 2)| .... |table(N of 3)(row Z)|
|---------------|--------------------|--------------------|------|--------------------|
...
...
...


These are the tools you need:

  1. Dynamic SQL
  2. nested queries
  3. rownum function
  4. case when

If possible, I would load the data from the database to your front end and change the representation there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜