How to can i store msg.payload in node red

I have remembered you were asking about this same project a couple months ago here: Copying my Door control status back to my Mysql databse

You also have this thread from earlier today: How to calculate 2 msg.id coming from 2 pub different topics simulataneously

If you have two separate messages arriving from MQTT nodes and you need to compare them, you need to get both values into a single message. I pointed you at a recipe for doing that here: How to calculate 2 msg.id coming from 2 pub different topics simulataneously

It is not clear if you have tried anything we have suggested. If there is something you are not sure about, please ask - but please read the material we point you at first.