Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
srisha
Starting Member
38 Posts |
Posted - 2013-05-29 : 05:50:31
|
select APIBH.cntbtch, APIBH.cntitem, amttaxdist,amtgrosdst,APIBH.idinvc, APIBH.idvend,dateinvc,textven,APIBD.textdesc,amtdistnet,billdate,amtdisthc,glamf.acctfmttd,acctdesc, --(select amtadjtot from APTCP where BATCHTYPE='AD')aptcp.AMTADJTOT, BATCHTYPEfrom APIBHinner join APIBD on APIBH .cntbtch= APIBD .cntbtch And APIBH.cntitem=APIBD.cntiteminner join glamf on APIBD .idglacct= glamf.acctfmttdinner join aptcp on APIBH.idinvc=aptcp .idinvc and apibh.idvend =aptcp .idvend where APIBD.cntbtch=3and APIBD.cntitem >= 1 and APIBD.cntitem <= 1order by APIBD.cntbtch |
|
srisha
Starting Member
38 Posts |
Posted - 2013-05-29 : 05:51:48
|
avoid the duplicate entry Help me |
 |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-05-29 : 05:52:50
|
what is the problem here?(select amtadjtot from APTCP where BATCHTYPE='AD') --> may be returning more than one row with duplicates?select DISTINCT amtadjtot from APTCP where BATCHTYPE='AD'--Chandu |
 |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-05-29 : 05:55:23
|
What is the purpose of this condition ? (and APIBD.cntitem >= 1 and APIBD.cntitem <= 1 ) --> this condition true only for APIBD.cntitem = 1--Chandu |
 |
|
srisha
Starting Member
38 Posts |
Posted - 2013-05-29 : 07:30:22
|
this is From and to |
 |
|
srisha
Starting Member
38 Posts |
Posted - 2013-05-29 : 07:32:44
|
select APIBH.cntbtch, APIBH.cntitem, amttaxdist,amtgrosdst,APIBH.idinvc, APIBH.idvend,dateinvc,textven,APIBD.textdesc,amtdistnet,billdate,amtdisthc,glamf.acctfmttd,acctdesc,aptcp.amtadjtot, BATCHTYPEfrom APIBHinner join APIBD on APIBH .cntbtch= APIBD .cntbtch And APIBH.cntitem=APIBD.cntiteminner join glamf on APIBD .idglacct= glamf.acctfmttdinner join aptcp on APIBH.idinvc=aptcp .idinvc and apibh.idvend =aptcp .idvend where APIBD.cntbtch={?Batch Number}and APIBD.cntitem >= {?Entry Number From} and APIBD.cntitem <= {?Entry Number To}order by APIBD.cntbtchsame problem duplict entrys |
 |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-05-29 : 07:54:54
|
Replace the "SELECT" key word with "SELECT Distinct", which will make sure every row to be unique.However, still if you feels that there is duplication then provide (just a couple of instances of) the duplicate data generated as a result of this query? And explain what makes you think them to be duplicate?CheersMIK |
 |
|
|
|
|
|
|