How to create double query SQL? -
i know how receive 1 result, and, result, give new query. have now:
select a.id_buc buc, a.id_promotor_altair ejecutivo cl_cliente a.id_buc=(select b.id_contrato contrato, b.id_buc buc, b.fec_apertura fecha el_contrato b b.id_contrato in (80121221158));
but query throws me errors.
there 2 problems in query:
- you should use
in
rather=
in case there 2 or more results inner query. - the inner query should return single column, values of column server filter field retrieve.
so, query should this:
select a.id_buc buc, a.id_promotor_altair ejecutivo cl_cliente a.id_buc in (select b.id_buc el_contrato b b.id_contrato in (80121221158));
but query bad , perform horribly. better if rewritten in single query using join
, can retrieve data of both tables, needed:
select a.id_buc buc, a.id_promotor_altair ejecutivo, b.id_contrato contrato, b.id_buc buc, b.fec_apertura fecha cl_cliente inner join el_contrato b on a.id_buc = b.id_buc b.id_contrato in (80121221158);
Comments
Post a Comment