On Thu, 24 Mar 2005, Sara wrote: > Following is the code used in my CGI script. > > my $query = $dbh -> prepare("SELECT * FROM invoices WHERE ID = '$ID'"); > $query -> execute(); > while (my @row = $query -> fetchrow_array()){ > print "$row[1] - $row[2] - $row[3]<br>"; > } > > What If I want to remove dupes from @row?
So add a UNIQUE filter to your SQL statement. The way to phrase this will be different depending on your database engine, but most or all SQL dialects support the UNIQUE command for SELECTing only unique elements. > I am also aware that Unique keys can be added within mySQL database, > but that's un-do-able due to some reasons. I want to remove dupes > within the script. I think these reasons are worth examining -- it's usually worth the effort to get your SQL statements to return just the data you want, rather than return too much and throw some of it away in your code. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>