Posts Tagged ‘JOIN’

SQL文 ジョインして更新

[TEXT]
update schedule set
[full_name] = user_info_table.last_name + ‘ ‘ + user_info_table.first_name
, [organization_name] = organization.organization_name
FROM [dbo].[schedule]
LEFT JOIN user_info_table ON user_info_table.user_info_table_id = schedule.user_info_table_id
left join user_info_table_organization on user_info_table_organization.user_info_table_id = user_info_table.user_info_table_id and user_info_table_organization.default_flg = 1
left join organization on organization.organization_id = user_info_table_organization.organization_id
WHERE full_name is null AND user_info_table.user_info_table_id is not NULL
[/TEXT]