Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 16th, 2006, 08:47 AM
urosbe urosbe is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 1 urosbe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 31 sec
Reputation Power: 0
How to merge 2 char fields in select statement

Hi!

I am newbie with Firebird, because I am using it with my projects for a few weeks now. I jumped from Microsoft SQL and I would like to know can to solve the following...

I have 2 char fields in database: NAME and SURNAME for example. In SQL it was possible to make the following statement:

SELECT NAME + ' ' + SURNAME AS FULL_NAME FROM TABLE

But here in Firebird I get error. Any solutions?

What I am trying to do is to show 2 char fields single columns combo box control. That's why I need 1 field as ID, and 1 field for text displayed in combobox. I don't have multi column control in this case so I have to figure how to merge to 2 char fields?

Regards!

Uros

Reply With Quote
  #2  
Old October 16th, 2006, 09:14 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,905 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 4 h 58 m 14 sec
Reputation Power: 279
Because + is NON standard way of putting two fields together, the standard operator is ||

Reply With Quote
  #3  
Old October 17th, 2006, 03:36 AM
upscene upscene is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 223 upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level)upscene User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 14 m 50 sec
Reputation Power: 8
In addition to that answer...

If any of the columns is NULL, a concatenate will return NULL as well:

'TEST' || ' ' || 'TEST' = 'TEST TEST'
NULL || ' ' || 'TEST' = NULL

Keep that in the back of your head


Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > How to merge 2 char fields in select statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway