2008 May 26 2:47 PM
Hi experts.
I have the following select, and I don't know why appear the message 'The column NR_VALIDACAO has two meanings'.
SELECT anr_validacao anr_revisao aatnam aatwrt
bcd_gr_regra bid_sit_regra
INTO TABLE t065
FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b
ON anr_validacao = bnr_validacao AND
anr_revisao = bnr_revisao AND
b~cd_gr_regra = v_regra
FOR ALL ENTRIES IN tdados
WHERE atnam = tdados-atnam
AND atwrt = tdados-atwrt
group by: nr_validacao, nr_Revisao
having cont >= 2.
endselect.
in table tdados i have 2 atnam and 2 atwrt.
in this select i want only nr_validacao tha have this 2 atnam and atwrt.
Can anyone help me??
Tks in advance...
Reward will be given!
Gabriel
Hi experts.
I have the following select, and I don't know why appear the message 'The column NR_VALIDACAO has two meanings'.
SELECT anr_validacao anr_revisao aatnam aatwrt
bcd_gr_regra bid_sit_regra
INTO TABLE t065
FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b
ON anr_validacao = bnr_validacao AND
anr_revisao = bnr_revisao AND
b~cd_gr_regra = v_regra
FOR ALL ENTRIES IN tdados
WHERE atnam = tdados-atnam
AND atwrt = tdados-atwrt
group by: nr_validacao, nr_Revisao
having cont >= 2.
endselect.
in table tdados i have 2 atnam and 2 atwrt.
in this select i want only nr_validacao tha have this 2 atnam and atwrt.
Can anyone help me??
Tks in advance...
Reward will be given!
Gabriel
2008 May 26 2:54 PM
Hello,
Change the fields in the group by clause as follow:
SELECT a~nr_validacao a~nr_revisao a~atnam a~atwrt
b~cd_gr_regra b~id_sit_regra
INTO TABLE t065
FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b
ON a~nr_validacao = b~nr_validacao AND
a~nr_revisao = b~nr_revisao AND
b~cd_gr_regra = v_regra
FOR ALL ENTRIES IN tdados
WHERE atnam = tdados-atnam
AND atwrt = tdados-atwrt
group by: a~nr_validacao, a~nr_Revisao
having cont >= 2.
endselect.
Regards,
2008 May 26 2:58 PM
hi,
Specify the table reference for nr_validacao as a or b as shown below....
SELECT anr_validacao anr_revisao aatnam aatwrt
bcd_gr_regra bid_sit_regra
INTO TABLE t065
FROM ztbvc_065 AS a INNER JOIN ztbvc_064 AS b
ON anr_validacao = bnr_validacao AND
anr_revisao = bnr_revisao AND
b~cd_gr_regra = v_regra
FOR ALL ENTRIES IN tdados
WHERE atnam = tdados-atnam
AND atwrt = tdados-atwrt
group by: anr_validacao, anr_Revisao
having cont >= 2.
endselect.
2008 May 26 3:11 PM
Hi Gabriel,
The filed nr_validacao is present in two of the tables (ztbvc_065 and ztbvc_064 ) So when using this field for grouping in the selection, you have to specify the table name explicitly.
use
group by: a~nr_validacao, nr_Revisao
or
group by: b~nr_validacao, nr_Revisao
as per the requirement.
Thanks
sapd
2008 May 27 2:51 AM
Hi,
Plz try to avoid using GROUPBY and ORDERBY clause in SELECT querry as due to the PERFORMANCE issue.
better use SORT stmt on the Internal table after data extraction.
Reward if helpful,
Thanks
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |