|
Johnathan
|
 |
« on: September 06, 2011, 08:22:11 AM » |
|
Hello. In my user table I have first_name and last_name, is there anyway I can get both of them, stick them together with a space inbetween and have it come out as display_name, like "first_name . ' ' . last_name as display_name" or something like that?
|
|
|
|
|
Logged
|
8==D~ 
|
|
|
|
SAMMo_0
|
 |
« Reply #1 on: September 06, 2011, 08:24:03 AM » |
|
insert a blank gif to take up the space.
LOL ONLY KIDDING I'M JUST A MOTHER FLIPPING DESIGNER!!! HAHAHAHAAAA!!!!
The answer could be cats for all I know.
<edited to take screw out>
|
|
|
|
« Last Edit: September 06, 2011, 08:27:14 AM by SAMMo_0 »
|
Logged
|
All your threads are belong to us.
|
|
|
|
Dom
|
 |
« Reply #2 on: September 06, 2011, 08:25:16 AM » |
|
For T-SQL: SELECT first_name + ' ' + last_name AS 'full_name' FROM tblUsers I'm not sure if you need to put the "AS 'full_name'" bit in, but it helps if you're referencing that "column" when ordering etc.
|
|
|
|
« Last Edit: September 06, 2011, 08:31:22 AM by Dom »
|
Logged
|
|
|
|
|
neal
|
 |
« Reply #3 on: September 06, 2011, 08:26:15 AM » |
|
SELECT CONCAT(`first_name`, ' ', `last_name`) AS display_name FROM [table_name]...
|
|
|
|
|
Logged
|
sig edited due to migrating from .net
|
|
|
|
Johnathan
|
 |
« Reply #4 on: September 06, 2011, 08:26:44 AM » |
|
Camelcase? Really? Also, Mr. France suggested CONCAT(), is one better than the other?
|
|
|
|
|
Logged
|
8==D~ 
|
|
|
|
Dom
|
 |
« Reply #5 on: September 06, 2011, 08:28:23 AM » |
|
Are you using SQL Server (T-SQL) or MySQL?
|
|
|
|
|
Logged
|
|
|
|
|
Johnathan
|
 |
« Reply #6 on: September 06, 2011, 08:29:41 AM » |
|
MySQL
|
|
|
|
|
Logged
|
8==D~ 
|
|
|
|
Dom
|
 |
« Reply #7 on: September 06, 2011, 08:31:08 AM » |
|
Oh. Ignore my reply then.
More than usual, I mean.
|
|
|
|
|
Logged
|
|
|
|
|
Johnathan
|
 |
« Reply #8 on: September 06, 2011, 08:34:34 AM » |
|
Cool. No probs.
Just need to wait on the server coming back online before I can try poo out.
|
|
|
|
|
Logged
|
8==D~ 
|
|
|
|
neal
|
 |
« Reply #9 on: September 06, 2011, 08:42:46 AM » |
|
FFS, I gave you the answer above. Don't give Mr France all the f*****g credit.
|
|
|
|
|
Logged
|
sig edited due to migrating from .net
|
|
|
|
Johnathan
|
 |
« Reply #10 on: September 06, 2011, 08:44:04 AM » |
|
Mr. France said it on Twitter first though, but I'll use your example because he nested his and it looks stupid.
|
|
|
|
|
Logged
|
8==D~ 
|
|
|
|
neal
|
 |
« Reply #11 on: September 06, 2011, 08:48:23 AM » |
|
I think you'll find I was busy writing a proper example as he just wrote concat and copied a url. I win the kudos.
|
|
|
|
|
Logged
|
sig edited due to migrating from .net
|
|
|
|
Dom
|
 |
« Reply #12 on: September 06, 2011, 08:50:13 AM » |
|
Also, in your Tweet, you mention @mr_france but there is actually a @mr_france on Twitter: http://twitter.com/mr_franceHe's gonna wonder what the hell is going on.
|
|
|
|
|
Logged
|
|
|
|
|
Johnathan
|
 |
« Reply #13 on: September 06, 2011, 08:55:07 AM » |
|
He deserves it for being so French.
|
|
|
|
|
Logged
|
8==D~ 
|
|
|
|