Skip to content
Advertisement

Save other ID in database

I have 2 table here :

How do I get the value retailRecipeID in tblPurItem? Because if I add like (SELECT D.recipeName FROM tblPosRecipe D WHERE A.retailRecipeID = D.recipeID LIMIT 1) AS recipeName , recipeName is null which is there is no data. I have to get the retailRecipeID because in this situation, I have form. Form 1 is tblPurItem and form 2 is tblRecipe. The form 1 have no problem but form 2 have problem.

When I success to submit the form 1, the form 2 will be popup on radiobutton= yes so that form 2 success to submit data. Now, my problem is data form 2 will be lost because do not link with form 1. And retailRecipeID also null in database. Anyone know the solution? Thank you!

It should be when I open back the form 1 and form 2 the data will displayed back but it show blank not the previous data.

pic1

SQL

Advertisement

Answer

use left join for tblRecipe and coalesce() function to get value 0 in your presentation layer in case of no matching recipe

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