Expand|Select|Wrap|Line Numbers
- Select TM.Order_code , TI.Order_NUMBER From OrderCheck TM
- Inner join OrderTable TI
- ON TM.OrderCode = TI.OrderCode
- Where OrderDate = @L_INV_DATE
- PRINT 'NULL VALUE'
- ELSE
- PRINT 'NOT NULL'
Select all the Order codes(order_code ) from OrderCode table
For each Order code, select the Order Number and Date from Order Master table ( OrderTable ) for all the Orders where date is same as parameter date
If there are no order for a particular Order_code, select the next Order_code from the OrderCode table and start again from step 1. Otherwise, insert the Date and Order code in the New table OrderDetail table
Here the OrderDetail table have some column common in the above mentioned table