我可能没有正确地获取我的条款,因此无法在Web上找到答案。Mysql在Select语句中为列名添加前缀
我有2代表这样
customer_db - Customer Data
CustomerID CustomerName CustomerContact
1 John 1234
2 Anna 5678
3 Angel 2468
customer_channel - Chat Channel Name
ChannelName OnlineStatus
private-customer-1 YES
private-customer-2 NO
所以通常我会做这样的事情
Select a.OnlineStatus, b.CustomerName, b.CustomerContact FROM customer_db a,
customer_channel b WHERE a.CustomerID = b.ChannelName
这里的“私人客户为”前缀是存在的,所以我不能做匹配。
我试着添加一个前缀,但它不起作用。 如何选择在WHERE语句中向列名添加“文本前缀”的表?
Select a.OnlineStatus, b.CustomerName, b.CustomerContact FROM customer_db a,
customer_channel b WHERE a.CustomerID = 'private-customer-'+b.ChannelName