Inicio de sesión

RSS

Distribuir contenido

En línea

En este momento hay 1 usuario y 1 invitado en línea.

Concatenar cadenas en MySQL

En MySQL existe la función CONCAT() la cual permite concatenar cadenas, es decir, unirlas.

SELECT CONCAT('subcategoria',' / ','categoria') FROM categorias

Esta función también nos permite concatenar campos y seleccionarlos como si fuera uno sólo.

SELECT idLocal, CONCAT('Direccion',' - ','Distrito','(','Ciudad',', ','Pais',')') AS Direccion FROM local

Esta consulta resultará en algo como:

Jr. La Paz 230, Sta. Patricia - La Molina (Lima, Perú)

Autor

Enviar un comentario nuevo

El contenido de este campo se mantiene como privado y no se muestra públicamente.
  • Las direcciones de las páginas web y las de correo se convierten en enlaces automáticamente.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <i> <b> <h2> <h3> <tt> <blockcode>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Saltos automáticos de líneas y de párrafos.
  • Every instance heading tags will be modified to include an id attribute for anchor linking.
  • Se pueden agregar imágenes a este envío.
  • Every instance of "<!--tableofcontents-->" in the input text will be replaced with a collapsible mediawiki-style table of contents. Accepts options for title, list style, minimum heading level, and maximum heading level as follows: <!--tableofcontents list: ol; title: Table of Contents; minlevel: 1; maxlevel: 3;-->. All arguments are optional and defaults are shown.

Más información sobre opciones de formato


Publicidad