簡體   English   中英

從表中選擇記錄,表本身是另一個查詢的結果

[英]select record from table which is table itself is a result of another query

我有以下 mysql 查詢:

select opportunity_id from (select join_table from relationships where lhs_module='Accounts' and rhs_module='Opportunities')

我收到以下錯誤消息:每個派生表都必須有自己的別名

是否可以從表中選擇記錄,表本身是另一個查詢的結果?

為什么你需要加入同一個表才能只使用'where'條件?

select opportunity_id from  relationships where lhs_module='Accounts' and rhs_module='Opportunities'

這應該對你有用,除非你有其他意圖,然后我們可以看到到目前為止。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM