Hi,
Try:
IF (@object_type = N'13' AND @transaction_type in (N'A', N'U') )
BEGIN
IF EXISTS(select a.DocEntry from INV1 a
where (a.PriceBefDi >= (SELECT q.[Price] FROM ITM1 q WHERE q.[PriceList] = 2 and q.ItemCode = a.ItemCode )
OR a.PriceBefDi <= (SELECT s.[Price] FROM ITM1 s WHERE s.[PriceList] = 1 and s.ItemCode = a.ItemCode))
and a.DocEntry = @list_of_cols_val_tab_del)
Begin
Set @error =1
set @error_message = 'Please check the price! Item is going either under cost or over cost....'
End
END
Thanks,
Gordon