본문 바로가기
SQL

Distinct top (1) SUBSTRING ORDER BY

by sj0020 2021. 7. 1.
  SELECT  Distinct top (1) SUBSTRING(propln_num,6,4) AS 'code' FROM dbo.production_plan_data  WHERE propln_num LIKE '2107%' ORDER BY 'code' desc