常量字段必须设置为MySQL
属性“Territory program”是一个常量字段,必须在结果集中设置为“Territory and Quota program”常量,我不想在表中添加新列,所以如果可能,如何在select语句中添加?我还有一个专栏状态 未分发-如果数据存在但尚未分发给员工 分布式-如果数据存在并分发给员工 已批准-如果员工批准 拒绝-如果员工拒绝 列分布,在Territory_标头中接受确定 到目前为止,我的代码是这样的常量字段必须设置为MySQL,mysql,sql,select,mysql-workbench,Mysql,Sql,Select,Mysql Workbench,属性“Territory program”是一个常量字段,必须在结果集中设置为“Territory and Quota program”常量,我不想在表中添加新列,所以如果可能,如何在select语句中添加?我还有一个专栏状态 未分发-如果数据存在但尚未分发给员工 分布式-如果数据存在并分发给员工 已批准-如果员工批准 拒绝-如果员工拒绝 列分布,在Territory_标头中接受确定 到目前为止,我的代码是这样的 Select user.p,user.e,CONCAT(user.p,user.p
Select user.p,user.e,CONCAT(user.p,user.pl,user.role) AS Territories, date_format(user.snapshot_date, '%d/%m/%y') As Startdate,date_format(user.refresh_date,'%d/%m/%y') As EndDate
只需在
select
列表中添加一个临时值:
select
user.p,
user.e,
concat(user.p,user.pl,user.role) AS Territories,
date_format(user.snapshot_date, '%d/%m/%y') As Startdate,
date_format(user.refresh_date,'%d/%m/%y') As EndDate,
'Territory and Quota Program' territory_program
from ...
请举例说明