The case is, when i generate new DO_Number below DO_Number Item Qty DO_004 BR_001 8
when DO_004 booked item BR_001 is there any query to show the NOTE above, to announce me there are another DO_Number that has booked item BR_001 based by DO_004
CREATE TRIGGER Tr_Insert
ON tab
FOR INSERT
AS
BEGIN
SELECT 'These items are reserved by DO_number below ' SELECT t.*
FROM tab t
JOIN inserted i ON t.Item = i.Item AND t.DO_Number != i.DO_Number
END
CREATE TRIGGER Tr_Insert
ON tab
FOR INSERT
AS
BEGIN
SELECT 'These items are reserved by DO_number below ' SELECT t.*
FROM tab t
JOIN inserted i ON t.Item = i.Item AND t.DO_Number != i.DO_Number
END
-- Chandu
thank you so much bud.. thank's to reply my post you're so kind
JOIN inserted i ON t.Item = i.Item AND t.DO_Number != i.DO_Number
inserted is the referencing table which holds recently inserted data. So we are joining this table with actual table (based on matching item value) and then excluding recently inserted DO_number from the output