Comments - What Join
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
After hours of wrestling with this I came up with something that gives me the desired result:
select *, SUM(Cantidad) from (select CatArticulos.ArticuloId, ArticuloNombre, ArticuloCodigo, ArticuloUnidad, ArticuloMin, ArticuloMax, ArticulosDisponibles, Cantidad, ArticuloDesc from CatArticulos left join ContenidosDeModelos on CatArticulos.ArticuloId=ContenidosDeModelos.ArticuloId where ModeloID = {$ModeloRec{'ModeloID'}} and ArticuloDeshabilitado = 'N' and ( ArticuloPara = 'Ordenes' or ArticuloPara = 'Todos' ) union all select ArticuloId, ArticuloNombre, ArticuloCodigo, ArticuloUnidad, ArticuloMin, ArticuloMax, ArticulosDisponibles, 0.0 as Cantidad, ArticuloDesc from CatArticulos) as x group by ArticuloId order by ArticuloCodigo
However I feel that there must be a more elegant straight forward way of writing it...
Any suggestions???
Richard
I've posted your question to the Maria-Discuss mailing list. Maybe someone there will have a suggestion.
Link to the email thread: https://lists.launchpad.net/maria-discuss/msg00745.html