根据特定值从多个表中选择多个列

时间:2017-05-24 13:37:55

标签: mysql database

Tables

嗨,我如何在这个表上选择不同的值来得到这样的报告:



<style type="text/css">
.tg  {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-yw4l{vertical-align:top}
</style>
<table class="tg">
  <tr>
    <th class="tg-031e">MATERIALES.COD_MATERIAL</th>
    <th class="tg-yw4l">MATERIALES.CANTIDAD_NECESARIA</th>
    <th class="tg-yw4l">RQ.ID</th>
    <th class="tg-yw4l">OC.ID_OC</th>
    <th class="tg-yw4l">ENTRADA.ID_EA</th>
    <th class="tg-yw4l">SALIDA.ID_SA</th>
  </tr>
  <tr>
    <td class="tg-yw4l">material code # 1</td>
    <td class="tg-yw4l">needed amount for material 1</td>
    <td class="tg-yw4l">RQ001</td>
    <td class="tg-yw4l">OC001</td>
    <td class="tg-yw4l">amount that arrived for material # 1</td>
    <td class="tg-yw4l">amount that was shipped for material # 2</td>
  </tr>
  <tr>
    <td class="tg-yw4l">material code # 2<br></td>
    <td class="tg-yw4l">needed amount for material 2</td>
    <td class="tg-yw4l">RQ001</td>
    <td class="tg-yw4l">OC001</td>
    <td class="tg-yw4l">amount that arrived for material # 1</td>
    <td class="tg-yw4l">amount that was shipped for material # 2</td>
  </tr>
</table>
&#13;
&#13;
&#13;

我一直在尝试不同的SQL查询,但我现在非常生疏。

0 个答案:

没有答案