sql - Rename a selected row in MYSQL -
how can rename value? it's giving me last selected value in in() clause.
select cf_1573, sum(counter) lyncs ( select cf_1573, count(cf_1573) counter vtiger_purchaseordercf cf_1573 in('lync front end (std)','lync front end (ent)','lync backend', 'lync edge','lync sba','lync dns checks','lync certificate checks') group cf_1573 ) mslync
i have output:
cf_1573 |lyncs lync certificate checks | 8
the sub-query
gave me this:
cf_1573 | counter lync certificate checks | 1 lync dns check | 3 lync edge | 1 lync sba | 3
i want output display "data lync" instead of "lync certificate checks" last value in in() clause
. help.
try below query.
select 'data lync' `cf_1573`, sum(counter) lyncs ( select cf_1573, count(cf_1573) counter vtiger_purchaseordercf cf_1573 in('lync front end (std)','lync front end (ent)','lync backend', 'lync edge','lync sba','lync dns checks','lync certificate checks') group cf_1573 ) mslync
Comments
Post a Comment