Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: [Help]Select Distinct problem from VB

Re: [Help]Select Distinct problem from VB

From: Graham Miller <lgmiller_at_elmrd.u-net.com>
Date: Sat, 25 Apr 1998 07:35:52 GMT
Message-ID: <35419044.407818@news.u-net.com>


"Tim Trimble" <ttrimble_at_fda.net> wrote (in <893442467.476839_at_wagasa.cts.com>)...
[snip]
|
| Here's the SQL statement:
| UPDATE MYTABLE SET MYFIELD =
| (SELECT DISTINCT OTHFIELD FROM TABLE2
| WHERE FIELD3 = 'myval')
| WHERE MYFIELD2 = 'myotherval'
|
| Any ideas?

Hello,
  Ensure that the subquery can only return *one* row. If it returns more than one row then the database engine is going to get confused trying to update one row with more than one value in the same column. Try using the max or min function.
On a separate point, the 'distinct' clause is redundant in a subquery. It only returns distinct values anyway.

graham Received on Sat Apr 25 1998 - 02:35:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US