title: Bash script: Mysql query field to variable
body: <p>I'm trying to obtain a recordset and read a few fields from it. I'm not able to figure it out how put the fields into variables. The script is:</p>
  
  <pre><code>#!/bin/bash
  sqlQuery="$(mysql -h host -u user -ppass -D oberonsaas_v2 -s -N -e 
  'select ventas.id_venta,
  ventas_entradas.id_ventas_entradas,
  ventas.id_evento,
  id_tarifa,
  DATE_FORMAT(fecha_evento,"%Y%m%d") as fecha,
  TIME_FORMAT(pase,"%H%i") as pase
  
  from pases,ventas,ventas_entradas,recintos
  
  where ventas.id_recinto = recintos.id_recinto 
  and ventas.id_pase = pases.id_pase
  and ventas.id_venta = ventas_entradas.id_venta
  and recintos.id_cliente = 32
  and ventas.estado="Pagada"
  and date(fecha_venta) = date_add(date(CURRENT_TIMESTAMP),INTERVAL -1 day)')"
  echo $sqlQuery
  </code></pre>
  
  <p>I get all the recordset in $sqlQuery, but i want to do a loop and concat the fields.</p>