select (@i:=@i+1)i,item_id,name as "节目名称",intro as "简介", CONCAT(episode,"集") as "集数",IF(status=1,"上线","下线")as "是否上线"
from item_info ,(select @i:=0)as i where copyright_owner_id=4 order by status desc;
用法解析:
1 . @i:=@i+1 和 (selec @i:=0) 这个对输出结果加上序列号
2. concat 用法 :本意是字符串拼接, 这里 对episode字段输出加上单位,拼接在一起输出就是 episode+"集"
3. if 用法: 对select 中的字段判断,根绝判断输出结果 : IF(status=1,"上线","下线")