我想hook_name
根据条件通过 SQL 选择查询动态添加另一列。
例如,如果hook_type = 0
, tablehook_name
的值应该是OFFER
,同样对于hook_type = 1
,hook_name
应该显示“ACCEPT”。
下面是结果的截图:
选择查询是这样的:
select hook_type, 'hook name' as hook_name,
count(*) as number_of_exchange_activities
from `exchange`
group by hook_type # hook_type 0 for OFFER, 1 for ACCEPT and 2 for offer EXPIRED;
提前致谢。