advanced (for me) SQL Query :)

  • Hello,

    i have a problem with my select query,

    i don't obtain the right information

    I have three views:

    ---------------------------------------------------------------------------

    v_configurationitem

    Brand                                      data : ("HEWLETT PACKARD")

    v_brand 

    object_id                                 data : ("1,00854654")

    Text                                       data: ("HEWLETT PACKARD")

    v_valuemapping

    External_value                         data: ("H.P.")

    Internal_value                          data : ("1,00854654")

    ---------------------------------------------------------------------------------------

    Now i want to obtain the data from External_value from the view v_valuemapping, so i want the value "H.P.", the starting point will be v_configurationitem

    As you can see i can only obtain this in 2 steps

    1. obtain the object_id from the view v_brand  ("1,00854654")
    2. with this object_id we can find the External_value from the view v_valuemapping which is ("H.P.")

    ---------------------------------------------------------------------------------------

    I have tried this but what i obtain is a list of all items from the valuemapping,

    here is the query i have tried:

    SELECT

    External_value

    FROM

    v_valuemapping

    WHERE

    EXISTS (SELECT v_valuemapping.EXTERNAL_VALUE

    FROM

    v_valuemapping, v_brand, v_configurationitem

    WHERE

    v_valuemapping.internalvalue = v_brand.OBJECT_ID and v_configurationitem.brand= 'H.P.')

    ---------------------------------------------------------------------------

    Can anyone please help

     

    many thanks and greetings

     

    Steve

     

     

     

  • select vvm.External_Value

    from v_valueconfigurationItem vvc

    join v_valuebrand vvb on vvc.Brand = vvb.Text

    join v_valuemapping vvm on vvb.ObjectId = vvm.InternalValue

    Where vvc.Brand = 'Hewlett Packard'

     

    ought to work

     

    S

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply