Yup, I forgot to point that I used this method and it works properly, but I 
need to add more params not related to another dataset. If I good 
understand I need to add virtual rows to select statement with custom 
values?

W dniu środa, 20 grudnia 2017 16:29:26 UTC+1 użytkownik Jeremy Evans 
napisał:
>
> On Wednesday, December 20, 2017 at 7:20:52 AM UTC-8, Anonymous Testing 
> wrote:
>>
>> Hi guys!
>> Is there any way to create Insert statement with SELECT statement inside 
>> it?
>> My use case - users have projects and each project has ID, but ID needs 
>> to be unique in the scope of the user.
>> Example:
>> { id: 1, user_id: 1, project_custom_id: 1 }
>> { id: 2, user_id: 2, project_custom_id: 1 }
>> { id: 3, user_id: 1, project_custom_id: 2 }
>>
>>
>> It is possible to do this insert query with select value for 
>> project_custom_id column.
>>
>
> DB[:table].insert([:column1, :column2], 
> DB[:other_table].select(:other_column1, :other_column2)) 
>
> Thanks,
> Jeremy
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to