Print Page | Close Window

Duplicate output

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4311
Printed Date: 30 March 2026 at 6:37am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Duplicate output
Posted By: ngaisteve1
Subject: Duplicate output
Date Posted: 17 July 2003 at 10:41pm

I have a problem here. I have 2 tables: requisition form and requisition item. When I click the requisition link, a new auto-generated no will be created. Then I will add the items it. The reason why I made 2 tables here because in one requisition form, there is only ONE requester, date and running no. Other reason it is more managable. When I want to view all item under one requisition form, the problem the total record will come out double or triple. Example, existing form got one item, when I add another one, it should be 2 but what comes out is 4. When I add another one, it becomes 6. When I view it from the database, it is correct no of records. What come out is duplicate data.

Example
my requisition form field
running_no
1

my requisition item field
stock_code running_no
221010 1
102088 1

My Output
running no: 1
stock code
221010
102088
102088
221010

My sql is like that
sql = "SELECT * FROM requisition_item as rq_item, stock as s, requisition_form as rq_form "
sql = sql & "WHERE rq_item.running_no = '" & session("sOldRunNo") & "' AND rq_item.stock_id = s.stock_id "

Hope you guys can help this one. Thanks.




Replies:
Posted By: ljamal
Date Posted: 17 July 2003 at 11:39pm
looks like you are joining 3 tables (requisition_item, stock, and requisition_form)

If you remove the requisition_form table from the select statement then you will not have any dupes.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: ngaisteve1
Date Posted: 17 July 2003 at 11:58pm
but in my output page, i need 1 field from requisition_form table. requisition form table has date.


Posted By: ljamal
Date Posted: 18 July 2003 at 12:05am
Then you should add
and rq_form.running_no = rq_item.running_no
to your SQL statement to remove the duplicates.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: ngaisteve1
Date Posted: 18 July 2003 at 12:11am
Alright, I got it. Don't why just now I tried that but failed. Now ok. Thanks.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net