1

作为一个新手,我再次需要你的帮助。这次我尝试在 MYSQL 6.0 中打印一份报告,该报告以下列格式显示每个分支及其位置:“分支名称”位于“城市名称”所在城市的“街道地址”。我也需要标签。这是我所做的并得到的结果:

SELECT CONCAT(name, ' ',  ' is located at', address, city, ' in the city of ')
FROM branch; 

我有一个名为 address 的列,其中包含 6 个街道地址。

4

1 回答 1

1

根据您的评论,听起来您只需要以下内容:

SELECT 
  CONCAT(name, ' is located at ', address,' in the city of ',  city) As Label
FROM branch; 

请参阅SQL Fiddle with Demo

这会产生以下结果:

|                                                          LABEL |
------------------------------------------------------------------
| Robinhood is located at 1234 Robinhood Rd in the city of Salem |
|           New is located at 123 test dr in the city of Testing |
于 2013-02-07T18:07:19.453 回答