LINUX.ORG.RU

История изменений

Исправление Darth_Revan, (текущая версия) :

Из любопытства посмотрел на пример вывода UNPIVOT из MSSQL и сделал так же:

SELECT info, spec FROM (
  SELECT 'shapka1' AS info, '11.11.2019 - 25.11.2019' AS spec
  UNION ALL
  SELECT 'shapka2', COUNT(CASE WHEN tip = 1 THEN 1 END) FROM nsoko12019
  UNION ALL
  SELECT 'shapka3', COUNT(CASE WHEN tip = 2 THEN 1 END) FROM nsoko12019
  UNION ALL
  SELECT 'shapka4', COUNT(CASE WHEN tip = 3 THEN 1 END) FROM nsoko12019
  UNION ALL
  SELECT 'shapka6', 140
) AS x;

Исходная версия Darth_Revan, :

Из любопытства посмотрел на пример вывода UNPIVOT из MSSQL и сделал так же:

SELECT info, spec FROM (
  SELECT 'shapka1' AS info, '11.11.2019 - 25.11.2019' AS spec FROM DUAL
  UNION ALL
  SELECT 'shapka2', COUNT(CASE WHEN tip = 1 THEN 1 END) FROM nsoko12019
  UNION ALL
  SELECT 'shapka3', COUNT(CASE WHEN tip = 2 THEN 1 END) FROM nsoko12019
  UNION ALL
  SELECT 'shapka4', COUNT(CASE WHEN tip = 3 THEN 1 END) FROM nsoko12019
  UNION ALL
  SELECT 'shapka6', 140 FROM DUAL
) AS x;