MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] [perl] question



On Wed, Nov 24, 1999 at 01:50:16AM -0600, Scott Swanson wrote:
> > >>
> > >> foreach $itemcode (@related_products) {
> > >>    my $productdescriptionhash=<<'EOF';
> > >>    [sql type=hash][arg]$itemcode[/arg]select description from products
> > >> where product_id = %s[/sql]
> > >> EOF
> > >
> > >Did you try:
> > > [sql type=hash]select description from products where product_id
> >='[item-code]'[/sql]
> >
> >The problem is that [item-code] is the identifier for the product being
> >displayed on the flypage.  $itemcode is the identifier for a item listed in
> >the related_products field of the products database for the current
> >[itemcode].  I suppose I could have used a more descriptive name than
> >$itemcode, such as $relateditemcode.  I am trying to pull the description
> >field from the database for each $itemcode, not [item-code]

OK, misunderstood meaning of $itemcode.

I'm just guessing now, since you've not provided enough of your schema
for me.  Have you tried doing it with a JOIN?  Something like:

SELECT related.description FROM products, products AS related, 
WHERE products.code=[item-code] AND products.product_id=related.product_id.

I'm guessing that you are trying to enter description only once for
a number of related products?  Seems to me this is more of a query
issue than perl, no?  Maybe I misunderstand.





-- 

Christopher F. Miller, Publisher                             cfm@maine.com
MaineStreet Communications, Inc         208 Portland Road, Gray, ME  04039
1.207.657.5078                                       http://www.maine.com/
Database publishing, e-commerce, office/internet integration, Debian linux.


Search for: Match: Format: Sort by: