Perhaps like this:

  -- SQLite version 3.20.1  [ Release: 2017-08-24 ]  on SQLitespeed version
  -- Script Items: 4          Parameter Count: 0
  -- ================================================================================================

create table source_table(value);

create table max_value(max_value NOT NULL);

insert OR IGNORE into max_value select max(value) from source_table;

select * from max_value;

  --   Script Stats: Total Script Execution Time:     0d 00h 00m and 00.031s

On 2018/01/10 6:48 PM, Shane Dev wrote:

sqlite> create table source_table(value);
sqlite> create table max_value(max_value);
sqlite> insert into max_value select max(value) from source_table;
sqlite> select * from table_max_value;


How can the maximum value of column source_table.value be inserted into
max_value only if there are records in source_table? (If source_table is
empty, nothing should be inserted into max_value, not even a NULL)
sqlite-users mailing list

sqlite-users mailing list

Reply via email to