sql case when then 语法使用

select distinct
        isa.site_id as siteId,
        sb.site_name as siteName,
        isf.id as id,
        isad.type_id as typeId,
        ist.type_name as typeName,
        isf.create_user_id as commitUserId,
        isad.content_item_id as contentItemId,
        u.user_phone as commitTelephone,
        case
        when isad.content_item_id IS NOT NULL THEN isci.item_name
        when isad.content_item_id IS NULL THEN isad.other_item_name
        end as contentItemName
        from table

  

sql case when then 语法使用

上一篇:MySQL数据库命令


下一篇:Zabbix告警:SQL Instance MSSQLSERVER: Could not allocate a new page