Задать вопрос
Ответы пользователя по тегу MySQL
  • составить SQL запрос

    @inittab
    Предложу свои 2 варианта:

    SELECT ID, PROJECT_ID, YEAR
    FROM PROJECT AS P1
    JOIN (SELECT PROJECT_ID, MIN(YEAR) AS YEAR
    	  FROM PROJECT
    	  GROUP BY PROJECT_ID
    	  ) AS P2
    ON P1.PROJECT_ID = P2.PROJECT_ID AND P1.YEAR = P2.YEAR


    SELECT ID, PROJECT_ID, YEAR
    FROM PROJECT
    WHERE (PROJECT_ID, YEAR) IN
    	  (
    	   SELECT PROJECT_ID, MIN(YEAR) AS YEAR
    	   FROM PROJECT
    	   GROUP BY PROJECT_ID
    	  )
    Ответ написан
    Комментировать