Subject | using a param on a join part of a query |
---|---|
Author | Sergio H. Gonzalez |
Post date | 2012-01-25T14:21:42Z |
Hello! This may be a silly question, but just in case I ask it anyway...
Is there any problem in doing something like this?
select
d.descripcion,
d.cantidad,
p.id as id_plan_ctas,
p.descripcion as desc_plan_ctas
from fac_ven_detalle d
left join cont_plan p on ((d.plan_ctas = p.codigo) and
(p.id_cont_periodo = :id_periodo))
where
(f.fecha between :desde and :hasta)
I mean, I'm using the ":id_periodo" param inside the join part of the
query. Of course, it works ok, but I just wander if this is the best way
to do it... or should I move it to the "where" part, like this?
select
d.descripcion,
d.cantidad,
p.id as id_plan_ctas,
p.descripcion as desc_plan_ctas
from fac_ven_detalle d
left join cont_plan p on (d.plan_ctas = p.codigo)
where
(f.fecha between :desde and :hasta)
and
(p.id_cont_periodo = :id_periodo)
thanks!!!!!!
-s
[Non-text portions of this message have been removed]
Is there any problem in doing something like this?
select
d.descripcion,
d.cantidad,
p.id as id_plan_ctas,
p.descripcion as desc_plan_ctas
from fac_ven_detalle d
left join cont_plan p on ((d.plan_ctas = p.codigo) and
(p.id_cont_periodo = :id_periodo))
where
(f.fecha between :desde and :hasta)
I mean, I'm using the ":id_periodo" param inside the join part of the
query. Of course, it works ok, but I just wander if this is the best way
to do it... or should I move it to the "where" part, like this?
select
d.descripcion,
d.cantidad,
p.id as id_plan_ctas,
p.descripcion as desc_plan_ctas
from fac_ven_detalle d
left join cont_plan p on (d.plan_ctas = p.codigo)
where
(f.fecha between :desde and :hasta)
and
(p.id_cont_periodo = :id_periodo)
thanks!!!!!!
-s
[Non-text portions of this message have been removed]