Re: syntax help - updating multiple rows

From: Frank van Bortel <frank.van.bortel_at_gmail.com>
Date: Tue, 29 Jan 2008 19:44:45 +0100
Message-ID: <63be3$479f741d$524b5c40$15175@cache5.tilbu1.nb.home.nl>


SpaceMarine wrote:
> hello,
>
> i am a non-SQL expert that occasionally has to do some queries. our
> environment is Oracle 9. i will gladly provide more info if needed.
>
> i am trying to:
>
>
> 1) get all the rows in a table that match a simple criteria, and

select <comma separated list of columns> from table_name
where
<column_name matches criteria>
[and column_name matches...]

More on the oracle docuemntation site, tahiti.oracle.com; look for the SQL Reference:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm

> 2) copy the column values from those rows into other rows in the same
> table.

>
> a bit more... we have an InpectionReports table. in it, we have a row
> for every Product for a given PO (purchase order) and InspectionTypeID
> (there are multiple types of inspections). i need a bit of SQL that
> will all let me find all the rows for a given PO/InspectionTypeID
> combo, and then copy my desired column values to all the rows for
> *another* given PO/InspectionTypeID combo.
>
> as i mentioned all of these rows are stored in the same table, since
> they are unique on ProductID/PO/InspectionTypeID.
>

select <comma separated list of columns> from inspection_reports
where
inspectiontypeid = 'WHATEVER' -- this is case sensitive! and PO = some_number;

That will list things (assuming inspectiontypeid is a character field, and po is numeric.).

Not sure what you mean by "my desired column values"; do you supply these, or are these from the table?

-- 

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
Received on Tue Jan 29 2008 - 12:44:45 CST

Original text of this message