I know to fetch the query but I have difficulties fetching in an advanced way or my requirement needs, my database is designed on the below structure, and I want to fetch the column value based on column type; like for Mango = 50, Banana = 20, etc.
ID | type | value | key
-----------------------------------
1 | Mango | 50 | AP123
2 | Banana | 20 | AP123
3 | Apple | 30 | AP123
In a simple way we can use this query -
SELECT * FROM table WHERE type = 'Mango' AND key = 'AP123'
but this is very complex to write the same code multiple times to get one result, here table key column value is the same, and on this basis I want to
Output will: 1 | Mango | 50 | AP123
but my requirement is like below -
SELECT * FROM table WHERE key = 'AP123'
let mango = 50
let banana = 20
let apple = 30
this is possible in any other way to achieve the goal, sorry for my bad English