Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2007
    Posts
    2

    Unanswered: Help with create view

    I am creating a view for the table:
    bellus=# select * from host_application_definition;
    id | type_value | connection_value | group_value | application_value | host
    ----+------------+------------------+-------------+-------------------+----


    From the table meta_host_types;

    id | value | types | name
    ----+-------+-----------+--------
    1 | agm | host-type | Rencid

    I would like to seperate value into type_value and connection_value, because it holds both values.

    Any tip?

    bellus=# \d host_application_definition;
    Table "public.host_application_definition"
    Column | Type | Modifiers
    -------------------+---------+--------------------------------------------------------------------------
    id | integer | not null default nextval('host_application_definition_id_seq'::regc lass)
    type_value | integer |
    connection_value | integer |
    group_value | integer |
    application_value | integer |
    host | integer |
    Indexes:
    "host_application_definition_pkey" PRIMARY KEY, btree (id)
    Foreign-key constraints:
    "host_application_definition_application_value_fke y" FOREIGN KEY (application_value) REFERENCES appsmarteye(id)
    "host_application_definition_connection_value_fkey " FOREIGN KEY (connection_value) REFERENCES meta_host_types(id)
    "host_application_definition_group_value_fkey" FOREIGN KEY (group_value) REFERENCES meta_host_grouptypes(id)
    "host_application_definition_host_fkey" FOREIGN KEY (host) REFERENCES master_hosts(id)
    "host_application_definition_type_value_fkey" FOREIGN KEY (type_value) REFERENCES meta_host_types(id)



    \d meta_host_types;
    Table "public.meta_host_types"
    Column | Type | Modifiers
    -------------+---------+---------------------------------------------------------------------
    id | integer | not null default nextval('meta_types_application_id_seq'::regclass)
    application | integer |
    value | text |
    comments | text |
    types | text |
    Indexes:
    "meta_types_application_pkey" PRIMARY KEY, btree (id)
    "meta_host_types_id_key" UNIQUE, btree (id)
    "meta_host_types_value_key" UNIQUE, btree (value, application)
    "meta_host_types_value_key1" UNIQUE, btree (value)
    Foreign-key constraints:
    "meta_types_application_application_fkey" FOREIGN KEY (application) REFERENCES appsmarteye(id)

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    because it holds both values
    how does it hold both values???

    How is it broken into multiple values?

    (BTW. In order to properly normalize the table, a field should only hold one meaning, not two or more... So, to "fix" the database, you should split the field into two, and concatenate when needed)
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •