Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Eliminate duplicates from search results Posted by Judi Bednar on 15 Jan 2003 at 7:37 AM
I am creating a search and results pages from a database. The search page works fine and the results page works fine. The database contains a series of client and matter names and numbers.

ClientName Client Matter
ClientA 123 001
ClientA 123 002
ClientA 123 003
ClientB 456 001

When I search for a client number the results display the client's name about 100 times (for example) because there are 100 matters so there are 100 records in the database. I'm not a programmer, I use Dreamweaver Ultradev. What snippet of code will help me eliminate my duplicates? When I search for ClientA, I just want to show ClientA=123. Hope that makes sense. Thanks.

Judi
Report
Re: Eliminate duplicates from search results Posted by haxme on 15 Jan 2003 at 2:18 PM
: I am creating a search and results pages from a database. The search page works fine and the results page works fine. The database contains a series of client and matter names and numbers.
:
: ClientName Client Matter
: ClientA 123 001
: ClientA 123 002
: ClientA 123 003
: ClientB 456 001
:
: When I search for a client number the results display the client's name about 100 times (for example) because there are 100 matters so there are 100 records in the database. I'm not a programmer, I use Dreamweaver Ultradev. What snippet of code will help me eliminate my duplicates? When I search for ClientA, I just want to show ClientA=123. Hope that makes sense. Thanks.
:
: Judi
:
Do LIKE THIS
In Your SQL set:
SELECT DISTINCT ClientName,Client FROM YourTable
/haxme


Report
Re: Eliminate duplicates from search results Posted by Judi Bednar on 15 Jan 2003 at 3:08 PM
: : I am creating a search and results pages from a database. The search page works fine and the results page works fine. The database contains a series of client and matter names and numbers.
: :
: : ClientName Client Matter
: : ClientA 123 001
: : ClientA 123 002
: : ClientA 123 003
: : ClientB 456 001
: :
: : When I search for a client number the results display the client's name about 100 times (for example) because there are 100 matters so there are 100 records in the database. I'm not a programmer, I use Dreamweaver Ultradev. What snippet of code will help me eliminate my duplicates? When I search for ClientA, I just want to show ClientA=123. Hope that makes sense. Thanks.
: :
: : Judi
: :
: Do LIKE THIS
: In Your SQL set:
: SELECT DISTINCT ClientName,Client FROM YourTable
: /haxme
:
My code (using dreamweaver MX) looks like this:

RS1.Source = "SELECT DISTINCT clientno, client, matterno, matter, atty FROM Climat WHERE client like '%" + Replace(RS1__varclient, "'", "''") + "%' ORDER BY client ASC"

And it still show all the records. That's why I'm confused.
Judi
Report
Re: Eliminate duplicates from search results Posted by haxme on 16 Jan 2003 at 10:40 AM
: : : I am creating a search and results pages from a database. The search page works fine and the results page works fine. The database contains a series of client and matter names and numbers.
: : :
: : : ClientName Client Matter
: : : ClientA 123 001
: : : ClientA 123 002
: : : ClientA 123 003
: : : ClientB 456 001
: : :
: : : When I search for a client number the results display the client's name about 100 times (for example) because there are 100 matters so there are 100 records in the database. I'm not a programmer, I use Dreamweaver Ultradev. What snippet of code will help me eliminate my duplicates? When I search for ClientA, I just want to show ClientA=123. Hope that makes sense. Thanks.
: : :
: : : Judi
: : :
: : Do LIKE THIS
: : In Your SQL set:
: : SELECT DISTINCT ClientName,Client FROM YourTable
: : /haxme
: :
: My code (using dreamweaver MX) looks like this:
:
: RS1.Source = "SELECT DISTINCT clientno, client, matterno, matter, atty FROM Climat WHERE client like '%" + Replace(RS1__varclient, "'", "''") + "%' ORDER BY client ASC"
:
: And it still show all the records. That's why I'm confused.
: Judi
:
OK! THEN TRY DISTINCTROW
The DISTINCT predicate is used to omit duplicate values just in a field.
The DISTINCTROW predicate is used to omit duplicate values in an entire record of fields.
/haxme


Report
Re: Eliminate duplicates from search results Posted by Judi Bednar on 16 Jan 2003 at 11:46 AM
: : : : I am creating a search and results pages from a database. The search page works fine and the results page works fine. The database contains a series of client and matter names and numbers.
: : : :
: : : : ClientName Client Matter
: : : : ClientA 123 001
: : : : ClientA 123 002
: : : : ClientA 123 003
: : : : ClientB 456 001
: : : :
: : : : When I search for a client number the results display the client's name about 100 times (for example) because there are 100 matters so there are 100 records in the database. I'm not a programmer, I use Dreamweaver Ultradev. What snippet of code will help me eliminate my duplicates? When I search for ClientA, I just want to show ClientA=123. Hope that makes sense. Thanks.
: : : :
: : : : Judi
: : : :
: : : Do LIKE THIS
: : : In Your SQL set:
: : : SELECT DISTINCT ClientName,Client FROM YourTable
: : : /haxme
: : :
: : My code (using dreamweaver MX) looks like this:
: :
: : RS1.Source = "SELECT DISTINCT clientno, client, matterno, matter, atty FROM Climat WHERE client like '%" + Replace(RS1__varclient, "'", "''") + "%' ORDER BY client ASC"
: :
: : And it still show all the records. That's why I'm confused.
: : Judi
: :
: OK! THEN TRY DISTINCTROW
: The DISTINCT predicate is used to omit duplicate values just in a field.
: The DISTINCTROW predicate is used to omit duplicate values in an entire record of fields.
: /haxme
:
--------
My bad. I took out my everything out of my SQL except Client and clientname and it worked just fine. Thanks for your help. It made me look at it in a different light.

Judi




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.