Fahdi’s Personal Blog

Here I share my web ideas

SQL: Joining (Concatenating two strings in SQL)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
December6

/*
mysql> select CONCAT(”a”,”B”);
+—————–+
| CONCAT(”a”,”B”) |
+—————–+
| aB |
+—————–+
1 row in set (0.00 sec)

*/
select CONCAT(”a”,”B”);

You can use this concat in any kind of SQL command! All depends upon your creativity. For example I had a country names database with a column for flag icons which I thoughtI would insert later on. It was empty for long time and only countries names were in it. So I got the country flag icons from a friend. Just put them in a folder and used concat for concatenating (joining) the names of the country names with a ‘.gif’ to generate the flag icons’ names! Used them in the update query and it worked. Saved me hours of data entry!

Share and Enjoy:
  • Digg
  • Facebook
  • LinkedIn
  • NewsVine
  • Technorati
  • Sphinn
  • del.icio.us
  • Mixx
  • Google
  • StumbleUpon
  • Live
  • Print this article!
  • feedmelinks
  • E-mail this story to a friend!
  • Reddit

Email will not be published

Website example

Your Comment: