How to get single record from select query..?

Hello All,

I want to get single record from select query.... i am getting output in object..?
I'm writing query in function like this

msg.topic= "select body from test limit 1;"
return msg;

i am getting this output
array[1]
0: object
body: "SI,310720,054307,1831.9042,N,07356.2427,E,61.01,0,1,0.0,A"

i want value of body in variable ... because i have to pass that value in another query.
Thanks

What node are ou using? Did you check the node's options to see if it can return one msg per record?

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

Or move the item to where you want it using a change node.

[{"id":"7d33b77c.2dfdd8","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload[0]","v":"{\"body\": \"SI,310720,054307,1831.9042,N,07356.2427,E,61.01,0,1,0.0,A\"}","vt":"json"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":140,"y":2020,"wires":[["53535fbb.5abe6"]]},{"id":"53535fbb.5abe6","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"move","p":"payload[0].body","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":2020,"wires":[["2a105b6e.c8af14"]]},{"id":"2a105b6e.c8af14","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":2020,"wires":[]}]

PFA
I am using function and mysql node .
in function node i write select query.

msg.topic= "select body from test limit 1;"
return msg;

feed it into a split node

how..if possible can you give example..?

You've already been given an example by @E1cid for using a Change node to move the property you want to where you need it. Import that flow and see what it does.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.