我想添加一个列,以便将用户标记为来自view_all_involved_users.scientist_id为scientist
,而将其他用户标记为others
VIEW `view_all_involved_users2` AS
SELECT DISTINCT
`tbl_user`.`user_id` AS `user_id`,
`tbl_user`.`name` AS `name`,
`view_all_involved_users`.`flagship_activity_id` AS `flagship_activity_id`
FROM
(`tbl_user`
LEFT JOIN `view_all_involved_users` ON (((`view_all_involved_users`.`flagship_leader` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`flagship_activity_focalpoint_id` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`flagship_activity_coleader_id` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`output_leader_id` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`output_coleader_id` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`scientist_id` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`clustuer_coordinator_id` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`scientist_id` = `tbl_user`.`user_id`)
OR (`view_all_involved_users`.`clustuer_cocoordinator_id` = `tbl_user`.`user_id`))))
答案 0 :(得分:1)
(CASE WHEN ISNULL(tbl_flagship_activity_result_scientists.user_id) THEN 'contact' ELSE 'scientist' END) AS type