Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有一个包含 Field1 和 Field2 的表,我可以在 select 语句中生成一个新字段吗?例如,一个普通的查询是:
SELECT Field1, Field2 FROM Table
而且我还想创建 Field3 并将其返回到结果集中......类似这样的东西将是理想的:
SELECT Field1, Field2, Field3 = 'Value' FROM Table
这可能吗?
SELECT Field1, Field2, 'Value' Field3 FROM Table
或为了清楚起见
SELECT Field1, Field2, 'Value' AS Field3 FROM Table
是的 - 这很有可能,事实上你几乎拥有它!尝试:
SELECT Field1, Field2, 'Value' AS `Field3` FROM Table