Ver Mensaje Individual
  #2 (permalink)  
Antiguo 23/12/2008, 05:15
jurena
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Cáceres
Mensajes: 3.735
Antigüedad: 16 años, 1 mes
Puntos: 300
Respuesta: Identificar Columna ¿posible?

¿Has probado esto?
Código sql:
Ver original
  1. SELECT id, col1, col2, col3, TRIM( CONCAT( IF( col1 = 'a', 'col1', '' ) , ' ', IF( col2 = 'a', 'col2', '' ) , ' ', IF( col3 = 'a', 'col3', '' ) ) ) columnas
  2. FROM `tabla`
  3. WHERE col1 = 'a'
  4. OR col2 = 'a'
  5. OR col3 = 'a'