Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

display the email distinctively for US users

User_19BPUMay 11 2020 — edited May 12 2020

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

Comments
Post Details
Added on May 11 2020
5 comments
311 views