ColdFusion: How to insert a list with a static foreign key in one insert?

前端 未结 4 1473
北海茫月
北海茫月 2021-01-21 10:45

I have a list like this thing1,thing2,thing3. And I want to insert them into a look-up table with the same foreign key. So ideally it would look like this:



        
4条回答
  •  忘掉有多难
    2021-01-21 11:04

    This answer is similar to Matt's but does not use conditional logic.

    
    insert into lkp_things (foreign_key, thing)
    select 0, ''
    where 1=2
    
    union
    select 
    , 
    
    

    Both our answers assume that the id variable does not change and was set somewhere else.

提交回复
热议问题