sql >> Database >  >> RDS >> Mysql

Bestel op VELD in MYSQL

hoe zit dit:

select a.col as type,coalesce (`COUNT`,0) as `count`
from 
(select 'A' as col union all
select 'B' as col union all
select 'C' as col union all
select 'D' as col )a
left join Table1 T
on a.col=T.type
order by FIELD(a.col,'A','B','C','D') ; 


SQL fiddle-demo




  1. Hoe kan ik dubbele rijen verwijderen?

  2. Hibernate Criteria Query om specifieke kolommen te krijgen

  3. Verschil tussen sys.views, sys.system_views en sys.all_views in SQL Server

  4. Verschil tussen inline en out-of-line beperkingen