developer155
Programmer
I am having problem with this query, instead of max event date for each customer, it returns max date for all customers on each row. What is wrong?
select
max(el1.feventdate), max(el2.feventdate), max(el3.feventdate)
from tprop p
inner join tcustomer c on p.ftracknum=c.ftracknum and p.fpropnum=p.fpropnum
and c.fcustomerid in (select fcustomerid from tcustomer where ftracknum=132291)
left join teventlog el1 on c.fcustomerid=el1.fcustomerid and el1.feventid='LEBS'
left join teventlog el2 on c.fcustomerid=el2.fcustomerid and el2.feventid='LBOR'
left join teventlog el3 on c.fcustomerid=el3.fcustomerid and el3.feventid='PRRF'
select
max(el1.feventdate), max(el2.feventdate), max(el3.feventdate)
from tprop p
inner join tcustomer c on p.ftracknum=c.ftracknum and p.fpropnum=p.fpropnum
and c.fcustomerid in (select fcustomerid from tcustomer where ftracknum=132291)
left join teventlog el1 on c.fcustomerid=el1.fcustomerid and el1.feventid='LEBS'
left join teventlog el2 on c.fcustomerid=el2.fcustomerid and el2.feventid='LBOR'
left join teventlog el3 on c.fcustomerid=el3.fcustomerid and el3.feventid='PRRF'