【问题标题】:Alias column name in where clause mysql [closed]where子句mysql中的别名列名[关闭]
【发布时间】:2021-03-04 15:34:36
【问题描述】:

这是 MySQL 代码

select id, name, code, batch_id from subjects where batch_id=18;

在此查询中,我希望 name 在执行期间成为主题名称。所以这就是整个问题。

【问题讨论】:

  • 不清楚你在问什么。您显示的查询看起来不错,您的问题是什么?
  • 请举例说明。

标签: mysql sql select where-clause


【解决方案1】:

您想要结果集中的列别名吗?

select id, name as subject_name, code, batch_id 
from subjects 
where batch_id = 18

这会将查询结果中name 列的名称更改为subject_name

我看不出您的问题与 where 子句有什么关系。

【讨论】:

  • 好的,达到标准
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-23
  • 2012-01-12
  • 1970-01-01
相关资源
最近更新 更多