Skip to Main Content

Results not correct when using HAVING

User_K2YTRNov 8 2021

I keep receiving two results when it should be one. Any ideas why? I have tried using FETCH but I believe since I am running 11g, it will not work. Included screenshot and example data from the view.
Book1.xlsx (12.41 KB)
Capture.JPG (46.72 KB)select woq.wq_number,woq.quote_amount,woq.wq_version from ba_view_wo_quote woq
left join sm_header smh on woq.woo_auto_key=smh.woo_auto_key
where WOQ.WOO_AUTO_KEY = SMH.WOO_AUTO_KEY and woq.wo_number = 'WO1110885'
and woq.quote_amount<>'0'
group by woq.wq_version,woq.quote_amount,woq.wq_number,woq.quote_date
having woq.wq_number=max(woq.wq_number)
order by woq.wq_version desc

Comments
Post Details
Added on Nov 8 2021
14 comments
65 views