2008 Jun 24 11:05 AM
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
2008 Jun 24 11:06 AM
put a distinct condition....
tat wll give the 1st appearance of values...wll remove duplication
2008 Jun 24 11:10 AM
hi
its like this
Select distinct .......
then us rest of query .
Cheers
Snehi
2008 Jun 24 11:17 AM
2008 Jun 24 11:23 AM
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
2008 Jun 24 12:57 PM
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
2008 Jun 24 1:02 PM
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
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |