WITH t1 AS ( SELECT YLPLID,MAX(SBSJ) SBSJ FROM YLPLCG where YLPLID in(select YLPLID from CYQYCPYLPLGX where CPID=‘659DE0BC42544B74B660E37E665F437C‘) group by YLPLID ) SELECT t.YLPLMC,case when t.YLPLLX =1 then ‘原料‘ when t.YLPLLX = 2 then ‘配料‘ end YLPLLX , t.GYSID,t.GYSMC,t.JYHGBGDTPID FROM YLPLCG t INNER JOIN t1 ON t.YLPLID = t1.YLPLID AND to_char(t.SBSJ, ‘yyyy-MM-dd HH24:mm:ss‘)= to_char(t1.SBSJ, ‘yyyy-MM-dd HH24:mm:ss‘)
时间: 2024-10-25 08:15:40