Gossamer Forum
Home : Products : Gossamer Links : Discussions :

late_by_cat and distinct listing

Quote Reply
late_by_cat and distinct listing
Hi.

Using following global for listing latest_n_by_cat (category downwards) called on category.html (courtsey afinlr)

sub {
my $tags=shift;
my $back;
my $cat_id = $tags->{ID};
my $all_ids = $DB->table('Category')->children($cat_id);
push @$all_ids,$cat_id;
my $link_db = $DB->table('Links','CatLinks');
$link_db->select_options('ORDER BY Add_Date DESC','LIMIT 25');
my $condition = GT::SQL::Condition->new( 'isValidated','=','Yes','CategoryID', 'IN', $all_ids);
my $sth = $link_db->select($condition);
while (my $link = $sth->fetchrow_hashref) {
$back .= Links::SiteHTML::display('newlink_cat',$link);
}

return $back;
}

Problem:
A Link may be listed under n sub-ctegories of a category...
This causes the lsiting to appear "n" number of times.

How can "Distinct" be enforced ?

TIA

Thanks
HyTC
==================================
Mail Me If Contacting Privately Is That Necessary.
==================================

Last edited by:

HyperTherm: Mar 31, 2005, 4:55 PM
Subject Author Views Date
Thread late_by_cat and distinct listing HyperTherm 6023 Mar 31, 2005, 4:52 PM
Thread Re: [HyperTherm] late_by_cat and distinct listing
afinlr 5943 Apr 4, 2005, 12:58 AM
Thread Re: [afinlr] late_by_cat and distinct listing
HyperTherm 5897 Apr 4, 2005, 7:50 AM
Thread Re: [HyperTherm] late_by_cat and distinct listing
afinlr 5857 Apr 4, 2005, 9:02 AM
Thread Re: [afinlr] late_by_cat and distinct listing
HyperTherm 5858 Apr 4, 2005, 9:20 AM
Thread Re: [HyperTherm] late_by_cat and distinct listing
afinlr 5889 Apr 4, 2005, 9:24 AM
Post Re: [afinlr] late_by_cat and distinct listing
HyperTherm 5886 Apr 4, 2005, 9:27 AM
Thread Re: [afinlr] late_by_cat and distinct listing
HyperTherm 5875 Apr 4, 2005, 10:39 AM
Thread Re: [HyperTherm] late_by_cat and distinct listing
Payooo 5882 Apr 4, 2005, 12:45 PM
Post Re: [Payooo] late_by_cat and distinct listing
HyperTherm 5843 Apr 4, 2005, 1:47 PM
Thread Re: [HyperTherm] late_by_cat and distinct listing
afinlr 5812 Apr 4, 2005, 7:46 PM
Thread Re: [afinlr] late_by_cat and distinct listing
HyperTherm 5861 Apr 4, 2005, 7:59 PM
Thread Re: [HyperTherm] late_by_cat and distinct listing
macbethgr 5777 Apr 13, 2005, 3:32 AM
Thread Re: [macbethgr] late_by_cat and distinct listing
HyperTherm 5791 Apr 13, 2005, 3:56 AM
Thread Re: [HyperTherm] late_by_cat and distinct listing
macbethgr 5779 Apr 13, 2005, 5:19 AM
Thread Re: [macbethgr] late_by_cat and distinct listing
afinlr 5741 Apr 13, 2005, 11:50 PM
Post Re: [afinlr] late_by_cat and distinct listing
macbethgr 5743 Apr 14, 2005, 5:31 AM