Codes here !
Moderators: macek, egami, gesf
If I have this line in a PHP page:
$result = mysql_query("SELECT value1,value2,value3 FROM $table ORDER BY value1");
Is there a way to merge the content of the 3 columns into one (let's call it value4) and order the results with that new value?
somebody told me about a "concat" function but I'm not sure about it
- New php-forum User
- Posts: 4
- Joined: Sat Oct 05, 2002 6:47 am
- Location: Hull, Quebec, Canada
you can use concat:
- Code: Select all
SELECT concat(`field1`,`field2`,`field3`) as `workname` FROM `sometable` ORDER BY `field1`;
this will return all records from the table and only one column named "workname" wich is field1 + field2 + field3.
See also Mysql Manual - Function Concat
Return to mySQL & php coding
Who is online
Users browsing this forum: No registered users and 3 guests