Re: QUERY

  • From: "biti_rainy" <biti_rainy@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 28 Apr 2004 10:31:12 +0800

hi,Seema Singh
   Any advice are welcome.
update main_test a
set a.directions =3D(select b.access1 from trail_main b
where b.trail_name =3D a.trail_name
     and b.trail_code =3D a.trail_code)
This is updating 6595 rows.


you  update all  the rows in table    main_test 
if the main_test has some rows but  the  key  values not in  =
 trail_main  
then you will update the directions =3D NULL  ;




>update main_test a
>set a.directions =3D (select access1 from trail_main b
>                     where a.trail_name =3D b.trail_name
>                       and a.trail_code =3D b.trail_code )
>where a.trail_id =3D ANY (select a.trail_id from
>                                vw_trail_main_test a, trail_main=
 b
>                         where a.trail_name =3D b.trail_name and=
 a.trail_code 
>=3D b.trail_code )

  this is  correct . you can only update the   rows in  main_test=
 that the  key  values  in  trail_main 
  



Best regards

yahoo id: feng_chunpei
A new dba from china

---- from the  mail-----
>Hi
>
>Any advice are welcome.
>update main_test a
>set a.directions =3D(select b.access1 from trail_main b
>where b.trail_name =3D a.trail_name
>     and b.trail_code =3D a.trail_code)
>This is updating 6595 rows.
>
>
>update main_test a
>set a.directions =3D (select access1 from trail_main b
>                     where a.trail_name =3D b.trail_name
>                       and a.trail_code =3D b.trail_code )
>where a.trail_id =3D ANY (select a.trail_id from
>                                vw_trail_main_test a, trail_main=
 b
>                         where a.trail_name =3D b.trail_name and=
 a.trail_code 
>=3D b.trail_code )
>This is updating 2599 rows updated.
>When I select
>select b.access1 from trail_main b
>where b.trail_name =3D a.trail_name
>     and b.trail_code =3D a.trail_code
>It returns 2599 rows.
>
>
>Wondering what is wrong?
>thx
>
>________________________________________________________________=
_
>FREE pop-up blocking with the new MSN Toolbar =96 get it now! 
>http://toolbar.msn.com/go/onm00200415ave/direct/01/
>
>----------------------------------------------------------------=

>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>----------------------------------------------------------------=

>To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
>put 'unsubscribe' in the subject line.
>--
>Archives are at //www.freelists.org/archives/oracle-l/
>FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
>----------------------------------------------------------------=
-
>
>.


=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1



----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: