I have the following SELECT
generated by a JSON array with objects that are hotels.
SELECT CONCAT(
'[',
GROUP_CONCAT(JSON_OBJECT('id', h.hotel_id , 'nom', h.nom, 'estrelles', h.categoria, 'puntuacio', h.puntacio, 'tipus', h.tipus, 'descripcio', h.descripcio, 'adreca', h.adreca, 'lat', h.latitud, 'lng', h.longitud, 'web', h.web )),
']'
)
FROM hotels h
The problem is that it only generates some hotels, not all of them.
[
{
"id": 1,
"lat": 41.39630126953125,
"lng": 2.166100025177002,
"nom": "987 Barcelona",
"web": "room-matehotels.com",
"tipus": "H",
"adreca": "Mallorca, 288",
"estrelles": 4,
"puntuacio": 4,
"descripcio": "Sus instalaciones constan de 1 bar, ascensores, terraza, recepción 24 h, cambio de moneda, servicio de lavandería, de niñera, una sala de conferencias de hasta 8 personas o servicio para minusválidos."
},
{
"id": 2,
"lat": 41.375999450683594,
"lng": 2.1670000553131104,
"nom": "Acta Millenni ",
"web": " hotel-millennibarcelona.com",
"tipus": "H",
"adreca": "Ronda de Sant Pau, 14",
"estrelles": 4,
"puntuacio": 3,
"descripcio": "A prop del centre de la ciutat i de la platja; botigues, llocs turístics, restaurants i bars a prop."
},
{
"id": 3,
"lat": 41.37900161743164,
"lng": 2.169600009918213,
"nom": "Barcelo Raval",
"web": "barcelo.com",
"tipus": "H",
"adreca": "Rambla del Raval, 17-21",
"estrelles": 4,
"puntuacio": 4,
"descripcio": "Mol bon hotel, bones habitacions i serveis.."
},
{
"id": 4,
"lat": 41.375198364257
]
As you can see in the last object it is half-way to generate it.
Any idea why he does this?