Does anyone know how to use a 'UNIQUE' feature in Links SQL's GT::SQL ? I currently have;
my $table = $DB->table('News');
$table->select_options ('ORDER BY Category ASC');
my $sth2 = $table->select();
my ($cats,@cats);
# set $got to true if we managed to find an entry matcinhg their details...
my $count = 0;
while (my $hit = $sth2->fetchrow_hashref) {
if ($count == 0) {
push(@cats,$hit->{Category});
}
foreach (@cats) {
chomp;
if ($hit->{Category} eq $_) { next; } else { push(@cats,$hit->{Category}); }
}
}
The problem with this is that it takes ages to load, an sometimes times out (over 100 categories). Is there a better/faster way to do this? I know 'unique' would do the job....but I can't find any documentation on itworking with GT::SQL
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
# first of all, we need to get the list of categories... my $table = $DB->table('News');
$table->select_options ('ORDER BY Category ASC');
my $sth2 = $table->select();
my ($cats,@cats);
# set $got to true if we managed to find an entry matcinhg their details...
my $count = 0;
while (my $hit = $sth2->fetchrow_hashref) {
if ($count == 0) {
push(@cats,$hit->{Category});
}
foreach (@cats) {
chomp;
if ($hit->{Category} eq $_) { next; } else { push(@cats,$hit->{Category}); }
}
}
The problem with this is that it takes ages to load, an sometimes times out (over 100 categories). Is there a better/faster way to do this? I know 'unique' would do the job....but I can't find any documentation on itworking with GT::SQL

Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!