我阅读了以下查询:
SELECT result.* FROM
(SELECT *
FROM t1
JOIN t2
ON t1.num = t2.num) AS result;
什么是SELECT a.* FROM my_table AS a JOIN your_table AS b ON ...
以及它的意思/做什么?
答案 0 :(得分:3)
表示“表a
中的所有列”,在您的示例中引用my_table
。
如果您想要特定的列,可以执行以下操作:
SELECT a.columnName, a.anotherColumn FROM my_table AS a JOIN your_table AS b ON ...
如果您想要a
和b
中的所有列,请执行以下操作:
SELECT a.*, b.* FROM my_table AS a JOIN your_table AS b ON ...
或者如果你想要一些来自a,而所有来自b:
SELECT a.columnName, a.anotherColumn, b.* FROM my_table AS a JOIN your_table AS b ON ...