2 ms·
> You can, and do, select any expressions, not only column name I find this very useful when I need to insert some fixed data alongside some data from the data
by magicalhippo 3y ago
> You can, and do, select any expressions, not only column name
I find this very useful when I need to insert some fixed data alongside some data from the database. I'll then use
insert into TableX(Key, TotalWeight, Name, Category)
select Key, sum(Weight), 'foo', 42 from TableY where Key = 1234 group by Key
or something like that. Usually the source of the fixed data is in a spreadsheet, so I just use Excel to generate the SQL statements.