I’m using two Stored Procedures and two Table in My Sql Server.
First Table Structure.

Second Table Structure.

When a Customer books a Order then the Data will be Inserted in Table 1.
I’m using a Select Query in another Page Which Selects the Details from the Second Table.
If a row with a billno from first table is not Present in Second Table I want to Insert into the Second Table with some Default Values in the Select Query. How can I do this
??
What you do is to
LEFT JOINthe two tables and then select only the ones where the second table had no row to join, meaning the bill number were missing.In the example below, you can replace
@default_inform_statusand @default_response_status with your default values.If it is possible to have duplicates of the same
Bill_Numberin the first table, you should also add aDISTINCTafter theSELECT. But considering the fact that it is a primary key, this is no issue for you.