Darkmatter5 Posted June 16, 2009 Share Posted June 16, 2009 If I have a table that has Firstname and Lastname as fields in each record, how can I build a query that returns an alias named "Name" using "Firstname Lastname"? Link to comment https://forums.phpfreaks.com/topic/162393-joining-two-items-in-a-query-into-one/ Share on other sites More sharing options...
kickstart Posted June 16, 2009 Share Posted June 16, 2009 Hi SELECT CONCAT(Firstname," ",Lastname) AS Name FROM someTable All the best Keith Link to comment https://forums.phpfreaks.com/topic/162393-joining-two-items-in-a-query-into-one/#findComment-857157 Share on other sites More sharing options...
fenway Posted June 18, 2009 Share Posted June 18, 2009 I prefer CONCAT_WS( '', Firstname, Lastname) -- makes it easier to add more columns. Link to comment https://forums.phpfreaks.com/topic/162393-joining-two-items-in-a-query-into-one/#findComment-859027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.