Kees Nuyt, on Tuesday, February 12, 2019 07:55 PM, wrote...
>On Tue, 12 Feb 2019 21:03:47 +0000, you wrote:
>> David Raymond, on Tuesday, February 12, 2019 03:48 PM, wrote...
>>> Not sure if this will fix your specific issue, but if you're using a query
>>> as a single
>>> value it needs to be in parenthesis, so something like
>>>
>>> insert into t (a, b, c, d, e, idate) values ('p006', 1, 2, (SELECT d FROM t
>>> WHERE a = 'p006'
>>> AND max(idate)), 4, '2019-02-12');
>>
>> I get,
>> sqlite> insert into t (a, b, c, d, e, idate)
>> values ('p001', 1, 2,
>> (SELECT d FROM t WHERE a = 'p001' AND max(idate)),
>> 4, '2019-02-12');
>> Error: misuse of aggregate function max()
>
>Try:
>insert into t (a, b, c, d, e, idate)
> values ('p001', 1, 2,
> (SELECT d FROM t
> WHERE a = 'p001'
> AND idate = (SELECT max(idate) FROM t WHERE a = 'p001')
> ),
> 4, '2019-02-12');
Man, you guys are good. Thanks. Yep, that works.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users