Wednesday, 23 May 2012
 Home arrow Articles arrow mysql arrow MySQL: Use CONCAT to include text in SELECT results
   
Main Menu
Home
News
Blog
Links
Search
FAQs
Spider
Articles
@intrenet
Free Softwares
Break for fun
Friends VIdeos
Techno videos
Contact Us
Disclaimer
Guest Book
Speed test
V.E.C. Calculator
IPv4 Subnet Calc
IPv6 Subnet Calc
Byte Converter
Converter
GMT/UTC Time
Bandwidth Calc
Allinone Calc
IANA Port Numbers
Country Call Codes
Pk Postal Codes
Surf Anonumously
Visitors Counter
mod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_countermod_vvisit_counter
mod_vvisit_counterToday198
mod_vvisit_counterYesterday260
mod_vvisit_counterThis week458
mod_vvisit_counterThis month5007
mod_vvisit_counterAll125683
 
 
 
 


MySQL: Use CONCAT to include text in SELECT results PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Amanatullah khalil   
Sunday, 24 May 2009

MySQL: Use CONCAT to include text in SELECT results

 

The CONCAT function in MySQL allows SELECT statements to act like printf commands by mingling text and query results together.


For example, to generate a quick list of links in HTML from a table ‘links’ with the columns ‘url’ (http://www.tech-recipes.com) and ‘title’ (Tech-Recipes) so that the output looks like:

Tech-Recipes

use a select statement like:

SELECT CONCAT('<a href="', url, '">', title, '</a><br />') FROM links;

The CONCAT function simply joins the comma-separated list of strings and expressions (in this case column results from the query: url and title). As with any SELECT statement, the result set can be varied with the use of an optional WHERE clause and other valid SQL syntax.

courtesy http://www.tech-recipes.com/rx/2059/mysql_use_concat_to_include_text_in_select_results/

 
< Prev   Next >
 
 
 
csatpk Newsflash
Statistics
OS: Linux h
PHP: 5.2.17
MySQL: 5.1.63-community-log
Time: 03:42
Caching: Disabled
GZIP: Disabled
Members: 3
News: 368
Web Links: 5
Visitors: 266022
Popular