We help IT Professionals succeed at work.

need a query to retrieve data

select h.order_number
from oe_order_headers_all h,
oe_order_lines_all l,
oe_order_sources s
where h.order_source_id = s.order_source_id
and h.header_id=l.header_id
and substrb(s.name,1,20)='IStore Account'

i have the following query oe_order_lines_all have attribute1 which stores the information of a line like  PP-UB-6 FI-DIA-NEG  now i  need to find the order number for whcih there are multiple lines and there is differnt attribute1 line stored for the same order, the order status can be closed or open it dosent matter
Comment
Watch Question

Database Developer & Administrator
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2012
Commented:
select * from
(select t.*,count(distinct attribute1) over(partition by header_id) cnt from oe_order_lines_all t)
where cnt > 1
awking00Information Technology Specialist
CERTIFIED EXPERT

Commented:
Perhaps you can supply some sample data and the expected data. Also, why would you say ... and substr(s.name,1,20) = 'IStore Account' and not
... and substr(s.name,1,14) = 'IStore Account'?
Sean StuberDatabase Developer & Administrator
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2012

Commented:
or better yet (assuming an index exists)

and s.name like 'IStore Account%'

Explore More ContentExplore courses, solutions, and other research materials related to this topic.