【发布时间】:2016-11-30 11:59:35
【问题描述】:
我可能没有正确理解我的条款,因此无法在网上找到答案。
我有两张这样的桌子
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
“private-customer-”前缀在哪里,所以我无法匹配。
我尝试添加前缀,但它不起作用。 如何在 WHERE 语句中选择在列名中添加“文本前缀”的表?
Select a.OnlineStatus, b.CustomerName, b.CustomerContact FROM customer_db a,
customer_channel b WHERE a.CustomerID = 'private-customer-'+b.ChannelName
【问题讨论】:
标签: mysql