是否可以在table1.first_name+“”+table1.last_name与table2.customer_name匹配的地方形成查询?
即:
customers.first_name=“约翰”
customers.last_name=“能源部”
orders.customer_name=“约翰·多伊”
在我看来,这是一个常见的查询,但不能直观地给出语法。
另外,我相信这不是一个“最佳实践”解决方案(使用id字段会更好),但是如果我不能控制模式,我只想知道是否有可能使用类似我的方法。
最佳答案
您正在查找concat
where concat(customers.first_name,' ',customers.last_name) = orders.customer_name
关于mysql - SQL:复合查询,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47914409/