[ic] Multiple Table Select under MySql

Gibi (EGPO) interchange-users@icdevgroup.org
Wed Aug 21 14:33:01 2002


Hi there,

I am using IC 4.8.3 and I am trying to create a componenet similar to the
promo component but I want to include a restriction that will only give me
the products that are on promotion and are members of a certain category.

Here is the part of the SQL statment I have created for the promo component:

[query arrayref=main
sql="
SELECT sku, timed_promotion, start_date, finish_date
FROM merchandising, products
WHERE featured = '[control promo_type specials]'
AND merchandising.sku = products.sku
AND products.category='COOK'
"][/query]
[perl tables="__UI_MERCH_TABLE__ merchandising"]
my @out;
my $ref;
my $db;
delete $Scratch->{promo_codes};
my $date = $Tag->time( { body => '%Y%m%d' } );
$ref = $Tmp->{main} or return;
for(@$ref) {
my $line = $_;
push(@out, $line->[0]), next if ! $line->[1];
next if $line->[2] gt $date;
next if $line->[3] lt $date;
push @out, $line->[0];
}
$Scratch->{promo_codes} = join(' ', @out);
return;
[/perl]


Please tell me what I am doing wrong.

Many Thanks,
Gibi Cohen