Creating a trigger to search in another table...
Hey peoples,
This is a quick query about using a MySQL trigger to do the following:
Sorry about the lack of details, but i haven't got many myself.
Once a new record is inserted into table DATATABLE, the trigger is activated.
The trigger then uses data in a couple of the new records fields, which comes up with two numerical variables VAR1 and VAR2.
The two variables are then used to search through a table GRIDTABLE, which gives a final name TEXTVALUE which is then added to the record, which is then inserted.
Examples:
During Record 1 Insert ---> Outputs 110.5 and 35.9 ---> Searchs in GRIDTABLE for the closest lower value to these 110 and 35 ---> GRIDTABLE give them the output of "Toilet Paper" ---> Record 1 is finally inserted, with "Toilet Paper" in final field.
During Record 2 Insert ---> Outputs 110.0 and 36.1 ---> Searchs in GRIDTABLE for the closest lower value to these 110 and 36 ---> GRIDTABLE give them the output of "Washing Powder" ---> Record 2 is finally inserted, with "Washing Powder" in final field.
Thanks for any help at all,
If you need any more details on this problem post them here.