08-20-04 07:52 AM
> Thank you for your response. Your information will come in very handy as I
> move on to setting up attributes.
>
> This particular problem was because I did not have the catentrel table set
> up correctly for some of the product to item relationships.
Yep, items must be correctly assigned to their appropriate parent
(ProductBean, PackageBean, etc.) as well. Here is a query that I use
frequently to locate a SKU's attribute values. Substitute your
partnumbers and database name appropriately. The buyable flag is optional.
select
a.catentry_id, ce.partnumber, a.attrvalue_id,
a.name, a.stringvalue, a.attrtype_id
from
<dbname>.attrvalue as a, <dbname>.catentry as ce
where
a.catentry_id = ce.catentry_id and
ce.buyable = 1 and
ce.partnumber in ('<partnumber1>', '<partnumber2>')
This query came in handy when I had to determine how many SKUs had 2
attributes, 3 attributes, and so on. This can be easily modified to
show which SKUs have 2, 3, or more attribute values rather than the
total count.
with attributecount as
(
select
distinct a.catentry_id as productcount,
count (attrvalue_id) as attrcount
from
<dbname>.attrvalue as a, <dbname>.catentry as p
where
a.catentry_id = p.catentry_id and
p.buyable = 1 and
p.catenttype_id = 'ItemBean'
group by a.catentry_id
)
select
count (productcount) as productcount, attrcount
from
attributecount
where
attrcount > 1
group by attrcount
order by attrcount
DB2 specific...your mileage may vary.
R
[ Post a follow-up to this message ]
|