On Wed, May 9, 2012 at 9:28 PM, YAN HONG YE <[email protected]> wrote:

> On  Wed, 9 May 2012 02:24:58 +0100
> Simon Slavin <[email protected]> wrote:
>
> > alter table myref add stkcode varchar(30);
> > update myref set stkcode = dzhhq.stkcode;
> >
> > this sql command couldn't run in my sqlite.
>
> It does not know which row from the table dzhhq it is meant to use.
>
> Simon.
>
> I means:
> use another table column, to update the current table column: like this:
> alter table myref add upfu;
> update myref set upfu =dzhhq.upfu where exists (select * from dzhhq where
> myref.stkname=dzhhq.stkname);
>
> but it said no such column: dzhhq.upfu
> but dzhhq.upfu really exist.
> _______________________________________________
>
Maybe you mean this?

 UPDATE myref
SET upfu=(SELECT dzhhq.upfu FROM dzhhq
                WHERE dzhhq.stkname=myref.stkname)
WHERE EXISTS (SELECT * FROM dzhhq WHERE dzhhq.stkname=myref.stkname);

--
   --
      --
         --Ô¿Ô--
        K e V i N
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to