select from (select ... )

must have alias. It should be

select from (select ... ) a





On Tue, May 20, 2014 at 9:38 AM, YAN HONG YE <yanhong...@mpsa.com> wrote:

> Hi,
> Sorry, I use mysql, not in sqlite, in mysql ,I run this command, the
> console show this error: do you know why?
> Thank you very much!
>
> mysql> UPDATE adlbk20140520a
>     -> SET pflopf = (
>     -> SELECT pflopf
>     -> FROM adl
>     -> WHERE adl.ref = adlbk20140520a.ref)
>     -> WHERE (
>     -> SELECT COUNT(*)
>     -> FROM (
>     -> SELECT 1 FROM adl
>     -> WHERE adl.ref = adlbk20140520a.ref
>     -> LIMIT 2
>     -> )
>     -> ) = 1;
> ERROR 1248 (42000): Every derived table must have its own alias
> mysql>
>
> >   Message: 8
> >   Date: Mon, 19 May 2014 09:55:25 +0300
> >   From: Paul <de...@ukr.net>
> >   To: sqlite-users@sqlite.org
> >   Cc: sqlite-users@sqlite.org
> >   Subject: Re: [sqlite] how to write this commands?
> >   Message-ID: <1400482276.625069613.b8rdb...@frv38.fwdcdn.com>
> >   Content-Type: text/plain; charset="UTF-8"
> >
> >
> >   > UPDATE adla1
> >   > SET pflopf = (
> >   > SELECT pflopf
> >   > FROM adl
> >   > WHERE adl.ref = adla1.ref)
> >   > WHERE (
> >   > SELECT COUNT(*)
> >   > FROM (
> >   > SELECT 1 FROM adl
> >   > WHERE adl.ref = adla1.ref
> >   > LIMIT 2
> >   > )
> >   > ) = 1;
> >   >
> >   > Not all sure what LIMIT 2 does there. I think a SQL-92 version
> >   > would be
> >   >
> >
> >   Limit, limits number of rows selected by ref. If we have found 2, no
> need to lookup further.
> >   That's why it was said to be a slightly optimized version. Generally
> this saves some disk reads.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to