sql

 avatar
user_0223141589
mysql
a year ago
488 B
2
Indexable
Never
select
sqp.name
,right(sqp.name, 4) as sequence
, sqp.CREATE_DATE
from BIZ.DBT_STG.STG_ODOO_PROD__STOCK_QUANT_PACKAGE sqp
join BIZ.DBT_STG.STG_ODOO_PROD__RES_USERS ru on sqp.CREATE_UID = ru.ID
join BIZ.DBT_STG.STG_ODOO_PROD__RES_PARTNER rp on rp.id = ru.PARTNER_ID
where date(sqp.CREATE_DATE) = '2023-03-14'
--where date(sqp.CREATE_DATE) = current_date
and left(sqp.name,2) = '1J'
--and sqp.name LIKE '1J08325000230313000%'
order by right(sqp.name, 4) desc, sqp.CREATE_DATE desc
--limit 1