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

时间:2017-09-06 21:11:01

标签: mysql sql

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

SQL OUTPUT:

 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

我不知道自己做错了什么。

1 个答案:

答案 0 :(得分:1)

试试这个:

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