SQL for ERP LN