如何在Mysql中显示顶级值作为顶部

时间:2016-12-04 12:50:31

标签: php mysql sql database

我想显示大学名称和应用程序数量来自每个大学,并显示大多数应用程序获得大学作为MySQL查询的第一个位置?

这是示例表,iter()是大学名称,clg列必须是application_name,最高值字段必须显示在顶部

enter image description here

我的结果必须是这样的......

enter image description here

2 个答案:

答案 0 :(得分:2)

试试这个,

{
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null"
  }
}

答案 1 :(得分:0)

我正在回答这个问题,因为public final class CaseInsensitive2 { private CaseInsensitive2() { } private static final Type mapStringObjectType = new TypeToken<Map<String, Object>>() { }.getType(); public static void main(final String... args) { final Gson originalGson = new Gson(); final Gson gson = decorateGson(originalGson); @SuppressWarnings("unchecked") final Map<String, Object> map1 = gson.fromJson(JSON_1, mapStringObjectType); @SuppressWarnings("unchecked") final Map<String, Object> map2 = gson.fromJson(JSON_2, mapStringObjectType); out.println(isTupleValid(map1)); out.println(isTupleValid(map2)); } private static boolean isTupleValid(final Map<String, Object> map) { return map != null && map.containsKey(TYPE) && map.containsKey(XID) && map.containsKey(CTP) && map.get(TYPE).equals("pageview"); } private static Gson decorateGson(final Gson originalGson) { @SuppressWarnings({ "unchecked", "rawtypes" }) final TypeAdapter<Map<String, Object>> adapter = (TypeAdapter) originalGson.getAdapter(Map.class); final JsonDeserializer<Map<String, Object>> typeAdapter = (json, type, context) -> normalizeMap(adapter.fromJsonTree(json)); return new GsonBuilder() .registerTypeAdapter(mapStringObjectType, typeAdapter) .create(); } } 中的列应该是唯一的,特别是在select子句中引用它们时。查询看起来应该更像:

order by