SQL Language (MOSC)

MOSC Banner

Need Assist With Upodate Statement That Returns Multiple Rows

edited Sep 26, 2011 7:00AM in SQL Language (MOSC) 7 commentsAnswered ✓
 Hi Folks
I am trying to figure out a way to write this update statement so that it only returns one row for each dataid
Any assistance is appreciated

Thanks
Jim

*********************************************

table: dtree (unique dataid)   dataid is (1 to many)

dataid
createdate
modifydate


table: dversdata (many docids to 1  dtree dataid - version is unique)

docid,
version
filecdate
filemdate

select:

select
dataid,
createdate,
docid,
version,
filecdate
from 
dtree,
dversdata
where
dataid=docid
and
createdate > TO_DATE ('20110826235900','yyyymmddhh24miss')
order by
docid,
version;


sample output:

    DATAID CREATEDAT      DOCID    VERSION FILECDATE
---------- --------- ---------- ---------- ---------
    498668 08-NOV-16     498668          1 20-DEC-04
    498668 08-NOV-16     498668          2 20-DEC-04
    498668 08-NOV-16     498668          3 20-DEC-04

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center