Hello!
I have a function called add_item()
which actually inserts values in a field item_name
of temporary table called temp
having fields temp_id
and item_name
. I have another table calleed item
which consists of fields item_id, item_name, price
. I have another table called quotation
which consists of fields q_id, item_id,item_name,price
.
Now I cant figure out how do i compare the item_name
from temp
to the field item_name
from item
. And then, insert the values of item in quotation
table. Can anyone guide me please?
For example i have the following records in temp
temp_id item_name
1 kit
2 drill
3 tester
and i have the following records in item:
id item_name price
1 drill A 100
2 drill B 354
3 drill C 743
4 tester 643
5 cccc 643
What I want to do is compare the item_name from temp table with that of table item.
after comparing i should insert these values in table quotation
quotation_id searched_name item_name price
1 kit not found null
2 drill drill A 100
3 drill drill B 354
4 drill drill C 743
5 tester tester 643
Can someone please guide me where to start?Thanks