Jake Thaw, on Thursday, November 14, 2019 05:27 PM, wrote...
>
> Why not like this?
>
> insert into t (a, b, c, d, e, idate)
> SELECT a, b, c, 'y', e, '2019-02-12' FROM t WHERE a = 'p001' ORDER BY
> idate desc limit 1;

Thanks.  Yes, this is great!  Darn it, I didn't think of this.  Thanks again.

josé
> On Fri, Nov 15, 2019 at 9:19 AM Simon Slavin, on
> >
> > On 14 Nov 2019, at 10:06pm, Jose Isaias Cabrera, on
> >
> > > insert into t (a, b, c, d, e, idate) values
> > >  (
> > >    (SELECT a FROM t WHERE a = 'p001' ORDER BY idate desc limit 1),
> > >    (SELECT b FROM t WHERE a = 'p001' ORDER BY idate desc limit 1),
> > >    (SELECT c FROM t WHERE a = 'p001' ORDER BY idate desc limit 1),
> > >    'y',
> > >    (SELECT e FROM t WHERE a = 'p001' ORDER BY idate desc limit 1),
> > >    '2019-02-12'
> > >  );
> > >
> > > Is there a simpler way?  Thanks.
> >
> > No simpler way.  I suggest you duplicate the exiting row first, then UPDATE 
> > the duplicate.

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to