Skip to content
Advertisement

Use empty table in SQL query

I have created a new SQL table of two column [Lot_no, Comment] which is empty.

I have another table of two column [Lot_no, Product_Code] which has values.


Problem:

  1. I want to create a SQL query where I retrieve [Lot_No|Product_Code|Comment] for some [Lot_No] but since no data is available for comment in first table it should return null in comment retrieved column.

  2. Later I want to insert new row of Lot_No and comment in that empty table. How can I do this?

Advertisement

Answer

A simple LEFT JOIN should do the trick. Perhaps something like this:

For the Insert

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement