You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何改写指定SQL查询语句以去除INNER JOIN关键字

Equivalent SQL Without INNER JOIN Keyword

Got it, here's the equivalent query that uses implicit joins (via the WHERE clause) instead of explicit INNER JOIN syntax—this will produce exactly the same result as your original query:

SELECT MAIN_ACCOUNTS.MAIN_ID, SUM(voucher.AMOUNT_US) "Total Amount"
FROM MAIN_ACCOUNTS, SUB_ACCOUNTS, Voucher
WHERE MAIN_ACCOUNTS.MAIN_ID = SUB_ACCOUNTS.MAIN_ID
  AND SUB_ACCOUNTS.SUB_ID = Voucher.credit_ACCOUNT_ID
GROUP BY MAIN_ACCOUNTS.MAIN_ID;

Quick Breakdown

This is the traditional "old-school" join syntax: we list all the tables we need in the FROM clause, then define the relationships between them directly in the WHERE clause. It works exactly like your original INNER JOIN query—only rows where the matching IDs line up across all three tables are included, and we still group by MAIN_ID to calculate the total amount per main account.

内容的提问来源于stack exchange,提问作者Ahmed S. Elsenbawy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:44:22