我正在做一個專案,我需要來自兩個不同表的資料,我對如何為其撰寫查詢感到困惑,如果可能,請幫助我。MYSQL查詢
table 1 : stagingScriptDB
table 2 :testBedSuiteMapping
我需要來自 stagingScriptDB 的所有資料,只需要來自 testBedSuiteMapping 的模板欄位。stagingScriptDB 欄位 idScriptDB
| 腳本名稱
| 平臺
| 腳本區
| 新區
| 磁區
| 模塊
| 組件
| 最小相對
| 套件資訊
| 總TC
| 運行時間
| 狀態
| 腳本提交者
| 更新_ts
| projectarea 和
testBedSuiteMapping 欄位:- testBedName
| 相關資訊
| 注冊型別
| 面積
| 平臺
| 套房
| 模板
| 塊
| 更新_ts
| ID
uj5u.com熱心網友回復:
您需要對表進行連接。他們有鏈接欄位嗎?“testBedSuiteMapping”必須有一些外鍵。
那么它會是這樣的
select stagingscriptdb.*, testbedsuitemapping.yourfield
from stagingscriptdb
inner join testbedsuitemapping on testbedsuitemapping.id = stagingscriptdb.id_stagingscriptdb
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/522272.html
標籤:mysql
