skip to Main Content

passing an array of objects in postgresql using node

var query = `select * from map_balances where balance_userid = $1 AND balance_vendorid = $2 AND balance_amount >= $3` var values = [accesstoken,token,arr.map(e=>e.vid),arr.map(e=>e.amt)]; client.query(query,{arr:values},async(err,projectdata)=>{ if (err) { res.json({success:false,message:err.message,responsecode:-1}); } else { res.json({success:true,message:projectdata.rowCount,responsecode:200}); } }); here arr=[{"vid": 636,"amt": "21","add": "123123"},{"vid": 636,"amt":…

VIEW QUESTION

json column with nested values

I have a JSON type SQL column in SQL table as below example. I want the below code to be converted into separate columns such as drugs as table name and other attribute as column name, how can I use…

VIEW QUESTION
Back To Top
Search