SELECT
    CAST(JSON_VALUE(CAST(FJSONDATA AS NVARCHAR(MAX)), '$.SaleOrderFinance[0].BillAllAmount_LC') as decimal(23,10) ) AS FPrice
From T_SCM_BILLCHANGEVERSIONS
WHere FVERSION = 
(
    Select MIN(FVERSION) as FVERSION From T_SCM_BILLCHANGEVERSIONS
    WHERE 
    FFORMID = 'SAL_SaleOrder'
    AND FBILLNO = 'PL-XSDD20250100329'
)
AND FFORMID = 'SAL_SaleOrder'
AND FBILLNO = 'PL-XSDD20250100329'
go
SELECT
    CAST(JSON_VALUE(CAST(FJSONDATA AS NVARCHAR(MAX)), '$.SaleOrderFinance[0].BillAllAmount_LC') as decimal(23,10) ) AS FPrice
From T_SCM_BILLCHANGEVERSIONS
WHere FVERSION = 
(
    Select MAX(FVERSION) as FVERSION From T_SCM_BILLCHANGEVERSIONS
    WHERE 
    FFORMID = 'SAL_SaleOrder'
    AND FBILLNO = 'PL-XSDD20250100329'
)
AND FFORMID = 'SAL_SaleOrder'
AND FBILLNO = 'PL-XSDD20250100329'


