Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL solution needed
Try this instead:
CREATE VIEW myView(
product , name , value )
SELECT
temp.productname
, parameter.name
, parameter.value
FROM
parameter
(
SELECT product.name productname , parameter.name parametername , MAX(parameter.version) maxversion FROM parameter , product_map , product WHERE product.version = product_map.version AND product_map.parent_version = parameter.version GROUP BY product.name , parameter.name
HTH,
Michael J. Ort
In article <8dfhkh$49a_at_nntpb.cb.lucent.com>,
"Gary Knopp" <gknopp_at_ascend.com> wrote:
>
> I'm trying to develop a system that stores all the parameters for a
> particular product release. As new releases are introduced, I want to
> be able to utilize parameters from past products that still apply if
the
> parameter value is still the same ( to avoid record duplication). At
any
> time I want to be able to query a past product and get a list of its
> parameters
> and values.
>
> I have figured out a way to do this with a view using a correlated
subquery,
> however it
> is not the most efficient solution. Does anyone have a better idea
how I
> could
> accomplish the above. I have enclosed my solution below.
>
> /**********************************************************/
> Below is an example of a solution with the expected results for each
query.
>
> PRODUCT - holds distinct names of all products
> PRODUCT_MAP - identifies past product parameters that are inherited on
> newer version.
> PARAMETER - contains a list of parameter and values. If a
paramter
> value
> changes in a new version than a new
> record is created for
> that new version.
>
> TABLE DATA
> =============
>
> PRODUCT PRODUCT_MAP
> PARAMETER
> ============== =====================
> =========================
> version name version parent_version
name
> value version
> ---------- ---------- ---------- ------------------
---
> ------- ------- -----------
> 1 Prd_A 1 1
> voltage 10 1
> 2 Prd_B 2 1
> current 20 1
> 3 Prd_C 2 2
> voltage 11 2
>
3 1
> current 21 3
>
3 2
> power 231 3
>
3 3
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Apr 17 2000 - 00:00:00 CDT
![]() |
![]() |