Keith Medcalf, on Thursday, November 14, 2019 06:44 PM, wrote...
>
>
> On Thursday, 14 November, 2019 15:27, Jake Thaw, on
>
> >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;
>
> Or, if using bound paramaters (and you should be):

What are bound parameters?  And where can I read about these?  I see people use 
the ? all the time, and I have no idea how that works.

> insert into t (a, b, c, d, e, idate)
>        select ?, b, c, ?, e, ?
>          from t
>         where a = ?1
>      order by idate desc
>         limit 1;
>
> then you bind the three parameters a, d, idate.

How do I bind the three parameters?

> Whether you want "order by idate desc" or "order by idate" depends on whether 
> you want the newest or oldest record to be the template.

Yep, this I know.  And yes, I want the newest, so descending is what I want.  
Thanks.

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

Reply via email to