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:
- Dynamic SQL
- nested queries
rownum
functioncase when
If possible, I would load the data from the database to your front end and change the representation there.
精彩评论