Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
Merge SQL Data in Row, HTML Table using Jquery

I am trying to merge data in row on the basis of date, but I got this

enter image description here

I need the result like this

enter image description here

The columns are generating dynamically. This is logic I tried. Please guide me. Thank you.

var vHtml = '<table id="example_Day" class="table table-hover" cellspacing="0" width="100%">';
vHtml += '<thead>';
vHtml += '<tr id="rowDay">';
vHtml += '<th>Date</th>';
for (var i = 0; i < count; i++) {
    ProductArray.push(Returndata[i]["ShortCode"]);
    DateArray.push(Returndata[i]["DemandDate"]);
    MedIDArray.push(Returndata[i]["MedicineID"]);
}
ProductArray = ProductArray.filter(onlyUnique);
for (var i = 0; i < ProductArray.length; i++) {
    vHtml += '<th>' + ProductArray[i] + '</th>';
}
vHtml += '<th>Paid / Free</th>';
vHtml += '</tr>';
vHtml += '</thead>';
vHtml += '<tbody>';
DateArray = DateArray.filter(onlyUnique);
MedIDArray = MedIDArray.filter(onlyUnique);

for (var j = 0; j < count; j++) {
    vHtml += '<tr>';
    vHtml += '<td>' + Returndata[j]["DemandDate"] + '</td>';

    for (var i = 0; i < MedIDArray.length; i++) {
        if (MedIDArray[i] == Returndata[j]["MedicineID"]){
            vHtml += '<td>' + Returndata[j]["Amount"] + '</td>';
        }
        else
        {
            vHtml += '<td> - </td>';
        }
    }
    vHtml += '<td>' + Returndata[j]["FreeOrPaid"] + '</td>';
    vHtml += '</tr>';
}



vHtml += '</tbody>';
vHtml += '</table>';

$('#table_day').html(vHtml);

1:

2:

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda