mysql - SQL 输出不是预期的。我究竟做错了什么?

标签 mysql sql

SELECT 
BOWLERFIRSTNAME || ' ' || BOWLERLASTNAME
"Bowler Name" , 
 BOWLERADDRESS || ' ' || BOWLERCITY || ' ' || BOWLERSTATE || ' ' || BOWLERZIP 
 "Bowler Address"
 FROM BOWLERS;

SQL 输出:

 Bowler Name
 ------------------------------ ------------------------------ ----------

 Bowler Address
 ------------------------------ ------------------------------ --------------------
Michael Viescas                                                                 

218 Main Street Redmond WA 98052                                                

Bailey Hallmark                                                                 

Route 2, Box 203B Woodinville WA 98072                                          

Rachel Patterson                                                                

16 Maple Lane Auburn WA 98002                                                   

Bowler Name
------------------------------ ------------------------------ --------------------
Bowler Address
------------------------------ ------------------------------ --------------------
Steve Pundt                                                                     

722 Moss Bay Blvd. Kirkland WA 98033                                            

Joe Rosales                                                                     

908 W. Capital Way Tacoma WA 98401                                              

选择了 32 行

输出应该是:

Bowler Name                     Bowler Address
------------------------------  -------------------------

Rachel Patterson                16 Maple Lane Auburn WA 98002

我不知道我做错了什么。

最佳答案

试试这个:

SELECT (BOWLERFIRSTNAME || ' ' || BOWLERLASTNAME) AS "Bowler Name" , 
 (BOWLERADDRESS || ' ' || BOWLERCITY || ' ' || BOWLERSTATE || ' ' || BOWLERZIP) AS "Bowler Address"
 FROM BOWLERS;

关于mysql - SQL 输出不是预期的。我究竟做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46084398/

相关文章:

PHP对象加载模式

php - ajax 请求返回意外输出,但输出正确

php - PDO 子句使用 for

SQL 组表按 "leading rows"没有 pl/sql

mysql - SQL 查询 "SELECT A.one, B.two FROM A INNER JOIN B ON A.three = B.three"的 Excel 等效项

sql - sql-server 的 dbext 连接字符串

mysql - 如何在单个列中加入 codeigniter 中的两个表

mysql - 了解 EXPLAIN MYSQL 命令的输出

mysql - 是否存在创建附加卷并执行 sql 脚本的 mysql docker 镜像的方法?

mysql - SQL仅选择列上具有最大值的行