hi,
Below SQL is displaying the results with duplicate email address for the user, using distinct is not making a difference , i want to display only the unique email address for these results set by avoiding duplicate records. Please let know how this query can be fine tuned to do it.
select distinct(du.email),ao.order_id, ao.sap_order_id, dod.creation_date,
dod.description,dod.submitted_date,dod.state,aue.ad_login_name, aue.sapsalesorg, do.CART_ITEMS_COUNT from
(select order_id,count(order_id) as CART_ITEMS_COUNT from
ORDER_ITEM group by order_id) do, ORDER ao ,Order_1 dod,USER aue,USER_1 du
where do.order_id = ao.order_id and do.order_id=dod.order_id and dod.state != 'INCOMPLETE'
and dod.profile_id=aue.user_id and dod.profile_id=du.id and dod.submitted_date >= '01-JAN-2019'
AND aue.user_country= 'US'
order by dod.submitted_date desc;
Thanks