Jan 6, 2005 #1 justride Programmer Jan 9, 2004 251 US Hi, How can I append 2 or more fields in a select statement. ex: Code: SELECT *, `RESTPHONE1`+`RESTPHONE2`+`RESTPHONE3` AS NUMBER FROM RESTAURANTS I want a string of 9 digits. ###.###.#### Thanks
Hi, How can I append 2 or more fields in a select statement. ex: Code: SELECT *, `RESTPHONE1`+`RESTPHONE2`+`RESTPHONE3` AS NUMBER FROM RESTAURANTS I want a string of 9 digits. ###.###.#### Thanks
Jan 6, 2005 #2 Bastien Programmer May 29, 2000 1,683 CA select *, concat(RESTPHONE1,"-",RESTPHONE2,"_",RESTPHONE3)... select *, concat_ws("-",RESTPHONE1,RESTPHONE2,,RESTPHONE3)... the _WS stands for with separator so you can define the separator first and then its just plugs them in. Bastien Cat, the other other white meat Upvote 0 Downvote
select *, concat(RESTPHONE1,"-",RESTPHONE2,"_",RESTPHONE3)... select *, concat_ws("-",RESTPHONE1,RESTPHONE2,,RESTPHONE3)... the _WS stands for with separator so you can define the separator first and then its just plugs them in. Bastien Cat, the other other white meat
Jan 6, 2005 Thread starter #3 justride Programmer Jan 9, 2004 251 US Thanks dude, that was what i was looking for! Upvote 0 Downvote
Jan 6, 2005 Thread starter #4 justride Programmer Jan 9, 2004 251 US One more question, will something like this work... Code: select *, FROM RESTAURANTS WHERE concat(RESTPHONE1,RESTPHONE2,RESTPHONE3) = '$number' Upvote 0 Downvote
One more question, will something like this work... Code: select *, FROM RESTAURANTS WHERE concat(RESTPHONE1,RESTPHONE2,RESTPHONE3) = '$number'
Jan 6, 2005 #5 Bastien Programmer May 29, 2000 1,683 CA try it Bastien Cat, the other other white meat Upvote 0 Downvote