Doubts

General issues about DbSchema
Post Reply
Giu
Posts: 2
Joined: Mon Jul 27, 2015 2:09 pm

Doubts

Post by Giu » Mon Jul 27, 2015 5:24 pm

Hi,

I'm evaluating DBSChema together other tools, and there are things I don't know how works.

For example, I had to build this query on querybuilder:

Code: Select all

SELECT
    `documentocomercial`.`id`
    , `detalledocumento`.`totalLinea`
    , `detalledocumento`.`cantidad`
    , `documentocomercial`.`totalDocumento`
    , `documentocomercial`.`fechaDocumento`
    , `comercial`.`nombreComercial` AS Comercial
    , `entidad`.`nombreComercial`
    , `entidad`.`razonSocial`
    , `entidad`.`esCliente`
    , `entidad`.`esProveedor`
    , `producto`.`nombreProducto`
    , `formatodeproducto`.`nombreFormato`
    , `documentocomercial`.`DTYPE`
    , `seriedocumento`.`nombreSerie`
    , `documentocomercial`.`facturado_en`
    , `documentocomercial`.`abonado_en`
FROM
    `detalledocumento`
    LEFT JOIN `producto` 
        ON (`detalledocumento`.`producto_id` = `producto`.`id`)
    LEFT JOIN `documentocomercial` 
        ON (`detalledocumento`.`documento_id` = `documentocomercial`.`id`)
    LEFT JOIN `formatodeproducto` 
        ON (`detalledocumento`.`formatoDeProducto_id` = `formatodeproducto`.`id`)
    LEFT JOIN `comercial` 
        ON (`documentocomercial`.`comercial_id` = `comercial`.`id`)
    INNER JOIN `entidad` 
        ON (`documentocomercial`.`entidad_id` = `entidad`.`id`)
    INNER JOIN `seriedocumento` 
        ON (`documentocomercial`.`serie_id` = `seriedocumento`.`id`)
WHERE (`documentocomercial`.`DTYPE` = 'AlbaranDeVenta' AND ISNULL(`documentocomercial`.`facturado_en`)
    OR (`documentocomercial`.`DTYPE` = 'FacturaDeVenta' AND ISNULL(`documentocomercial`.`abonado_en`)))
    AND `seriedocumento`.`notas` = 0
I had to do it in other tool because:
First, was impossible to me to create in order and preference the where clause
Was impossible to assign an alias to a field.

I asked too in other subforum but to have it in one post.
In this query, how can I apply a group by to a field? For example, I want my previous query, to sum a field and groupby by fechaDocumento. I didn't found anything to do this.

davidfrost
Posts: 44
Joined: Sun Sep 28, 2014 11:35 am

Re: Doubts

Post by davidfrost » Tue Jul 28, 2015 2:42 pm

how can I apply a group by to a field?
I'd also like to know if that is possible please.

sumptuous
Posts: 1
Joined: Tue Jan 24, 2017 8:02 pm
Contact:

Re: Doubts

Post by sumptuous » Fri Apr 14, 2017 5:20 pm

I'd like to know it too, i greet you

Post Reply