Jump to content


Rafael Lucas

Member Since 06/03/2012
Offline Last Active 06/03/2012, 19:28
-----

Posts I've Made

In Topic: Select Union Não Estou Conseguindo

06/03/2012, 19:28

Boa noite,

Para usar um union vc tem que ter o mesmo numero de coluna nos dois selects e as colunas tem que ser do mesmo tipo.... vou usar o seu como exemplo...



select CD_NOTA_FISCAL, EMITENTE, PRODUTO, DATA from lbr_notafiscal where lbr_notafiscal_id in
(select lbr_notafiscal_id from lbr_notafiscalline where m_attributesetinstance_id in
(select m_attributesetinstance_id from m_attributeinstance where value IN ('LKHNC1BG4BAT04412')));

UNION ALL

select CD_ORDER, EMITENTE, PRODUTO, DATA from c_order where c_order_id in
(select c_order_id from c_orderline where m_attributesetinstance_id in
(select m_attributesetinstance_id from m_attributeinstance where value = 'LKHCH1AGXBAV01014'))

Lembrando que as colunas tem que ser do mesmo tipo, inteiro com inteiro, string com string.. etc


Espero ter ajudado.

att,
Rafael

IPB Skin By Virteq