need some help with an opennms query/insert

From: "Patrick Ramsey" <Patrick(dot)Ramsey(at)wellstar(dot)org>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: need some help with an opennms query/insert
Date: 2007-11-02 18:02:48
Message-ID: 472B2E08.17DE.0070.0@wellstar.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hey guys,

I am an OpenNMS admin and new to Postgres. I have just updated around 1100 devices manually with multiple categories and left out a category from each... What I would like to do is run a sql statement that will select any node with a category ID of X and add to that node a category ID of Y....

pgsql 8.1.5

table looks like this:

public.category_node (trimmed to one nodeid)

categoryid nodeid
27 865
26 865
I want to search all rows for categoryid of 27, then insert a row with categoryid of 30 to that same nodeid. so it would look like this.

categoryid nodeid
27 865
26 865
30 865

I think I have this much:

SELECT "categoryid" FROM "public"."category_node" WHERE "categoryid" = '27'

Is this the right track? and then, how do I insert a row?

thanks!

-P

________________________________________________
This email and any files transmitted with it may contain
confidential and /or proprietary information in the possession
of WellStar Health System, Inc. ("WellStar") and is intended
only for the individual or entity to whom addressed. This email
may contain information that is held to be privileged, confidential
and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby
notified that any unauthorized access, dissemination, distribution
or copying of any information from this email is strictly prohibited,
and may subject you to criminal and/or civil liability. If you have
received this email in error, please notify the sender by reply email
and then delete this email and its attachments from your computer.
- Thank you.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Alan Hodgson 2007-11-02 18:39:28 Re: need some help with an opennms query/insert
Previous Message Jon Sime 2007-11-01 00:16:01 Re: What data type best used for money