我知道如何连接多个表,但我尝试显示两个不同列中的1列的值。
所以:
table1.codseller = table2.id 和 table1.codbuyer = table2.id
示例:
TABLE1
id_ord | order | codseller | codbuyer| qty | price
----------+-------+------------+---------+---------------+---------
09518709 | 4 | 001 | 002 | 8888 | 5
09518710 | 5 | 002 | 004 | 8888 | 6
09518712 | 6 | 001 | 006 | 8888 | 9
09518713 | 7 | 001 | 003 | 8888 | 4
TABLE2
id | location |
----------+-------+--
001 | USA |
002 | CAN |
003 | GER |
004 | USA |
005 | GER |
006 | UKN |
RESULT:
id_ord | order | codseller | codbuyer| sel_loca | buy_loc
----------+-------+------------+---------+---------------+---------
09518709 | 4 | 001 | 002 | USA | CAN
09518710 | 5 | 002 | 004 | CAN | USA
09518712 | 6 | 001 | 006 | USA | UKN
09518713 | 7 | 001 | 003 | USA | GER
答案 0 :(得分:1)
您可以使用如下所示的子查询。
<table>
<tr>
<th><h3>Date</h3></th>
<th><h3>Location</h3></th>
<th><h3>Link</h3></th>
</tr>
#loop(reports, "report") {
<tr>
<td>#(report.date)</td>
<td>#dataPoint(report, "ort", "data")</td>
<td><a href="/bericht/#(report.id)">Complete Report Data</a></td>
</tr>
}
</table>