Php MYSql,不同种类的交叉表报告

时间:2015-07-09 09:18:23

标签: php mysql report crosstab

我有2个表,comparitive_st_sup和comparitive_statement1

comparitive_st_sup字段如下:

  • tender_id
  • supplier_name
  • ITEM_NAME
  • 单价

comparitive_statement1字段如下:

  • tender_id
  • sup_name(供应商名称)
  • coc_charges
  • export_charges
  • iata_charges

这两个表都是由supplier_name链接的。 comparitive_st_sup表为单个供应商提供了许多item_name(项目或产品)。 comparitive_statement1的详细信息包括供应商及其成本(数量,单价和总计)

现在我需要一份报告来采用以下格式:

<p>Data from comparitive_st_sup table</p>
<table border="1" width="100%">
	<tr>
		<td colspan="3" width="33%">
		<p align="center"><b>Supplier 1 Name</b></td>
		<td colspan="3" width="33%">
		<p align="center"><b>Supplier 2 Name</b></td>
		<td colspan="3" width="33%">
		<p align="center"><b>Supplier 3 Name</b></td>
	</tr>
	<tr>
		<td>Item name</td>
		<td>unit price</td>
		<td>qty</td>
		<td>item name</td>
		<td>unit price</td>
		<td>qty</td>
		<td>item name</td>
		<td>unit price</td>
		<td>qty</td>
	</tr>
	<tr>
		<td>item name</td>
		<td>unit price</td>
		<td>qty</td>
		<td>item name</td>
		<td>unit price</td>
		<td>qty</td>
		<td>item name</td>
		<td>unit price</td>
		<td>qty</td>
	</tr>
	<tr>
		<td colspan="3">&nbsp;</td>
		<td colspan="3">&nbsp;</td>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="3">Data from comparitive_statement1 table</td>
		<td colspan="3">&nbsp;</td>
		<td colspan="3">&nbsp;</td>
	</tr>
	<tr>
		<td colspan="3">
		<p align="center"><b>Supplier 1 Name</b></td>
		<td colspan="3">
		<p align="center"><b>Supplier 2 Name</b></td>
		<td colspan="3">
		<p align="center"><b>Supplier 3 Name</b></td>
	</tr>
	<tr>
		<td colspan="3">COC Charges</td>
		<td colspan="3">COC Charges</td>
		<td colspan="3">COC Charges</td>
	</tr>
	<tr>
		<td colspan="3">Export Charges</td>
		<td colspan="3">Export Charges</td>
		<td colspan="3">Export Charges</td>
	</tr>
	<tr>
		<td colspan="3">Iata_Charges</td>
		<td colspan="3">Iata_Charges</td>
		<td colspan="3">Iata_Charges</td>
	</tr>
</table>

我怎样才能做到这一点?请帮助。提前完成。

0 个答案:

没有答案