SQL语句:type类型1、2、3、4用具体的内容来显示

例题:MySQL数据库字段:`type` int(1) DEFAULT '0' COMMENT '类别,5:第三方,1:政府,2:高校,3:媒体,4:同行,'


用SQL语句表示case type when 1 then '政府' when 2 then '高校' when 3 then '媒体' when 4 then '同行' when 5 then '第三方' end


完整的SQL实例:

SELECT b.name as 所属组织,a.resource as 单位,

(case a.type when 1 then '政府' when 2 then '高校' when 3 then '媒体' when 4 then '同行' when 5 then '第三方'end) as 合作主题,

a.contact as 姓名,a.job as 职务,a.contact_mobile as 联系电话,

a.track_count as 跟踪次数 FROM cx_external_resources a,cx_role b WHERE a.incubator_id = b.id

ORDER BY a.update_time DESC

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容