Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to avoid data repetation when using select statements with innerjoin

Former Member
0 Likes
834

how to avoid data repetation when using select statements with innerjoin.

thanks in advance,

satheesh

how to avoid data repetation when using select statements with innerjoin.

thanks in advance,

satheesh

6 REPLIES 6
Read only

Former Member
0 Likes
797

put a distinct condition....

tat wll give the 1st appearance of values...wll remove duplication

Read only

Former Member
0 Likes
797

hi

its like this

Select distinct .......

then us rest of query .

Cheers

Snehi

Read only

Former Member
0 Likes
797

Hi,

Use distinct in Select statement.

Regards.

Read only

Former Member
0 Likes
797

Hi Sateesh,

In your select statement use the keyword DISTINCT to avoid duplicate records.

Check the following syntax:

SELECT [DISTINCT] <cols> ... WHERE ...

...

ENDSELECT.

Hope this helps you,

Any queries, get back to me.

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
797

you can use a query like this...

SELECT DISTINCT

frg~prc_group1 "Product Group 1

frg~prc_group2 "Product Group 2

frg~prc_group3 "Product Group 3

frg~prc_group4 "Product Group 4

frg~prc_group5 "Product Group 5

prc~product_id "Product ID

txt~short_text "Product Description

UP TO 10 ROWS

INTO TABLE l_i_data

FROM

  • Joining CRMM_PR_SALESG and

  • COMM_PR_FRG_ROD

crmm_pr_salesg AS frg

INNER JOIN comm_pr_frg_rod AS prd

ON frgfrg_guid = prdfragment_guid

  • Joining COMM_PRODUCT and

  • COMM_PR_FRG_ROD

INNER JOIN comm_product AS prc

ON prdproduct_guid = prcproduct_guid

  • Joining COMM_PRSHTEXT and

  • COMM_PR_FRG_ROD

INNER JOIN comm_prshtext AS txt

ON prdproduct_guid = txtproduct_guid

WHERE frg~prc_group1 IN r_zprc_group1

AND frg~prc_group2 IN r_zprc_group2

AND frg~prc_group3 IN r_zprc_group3

AND frg~prc_group4 IN r_zprc_group4

AND frg~prc_group5 IN r_zprc_group5.

reward it it helps

Edited by: Apan Kumar Motilal on Jun 24, 2008 1:57 PM

Read only

Former Member
0 Likes
797

Hi,

After writing the select query using inner join and after all data is fectched into a internal table. sort the table by primary key fields and then use the DELETE...ADJACEENT DUPLICATES.. clause .

Or we can also go for SELECT---DISCTINCT .

Reward points if useful.

Regards

Chandralekha