Google Query Language: How to select the min value?
I am doing some web scraping task, and I get prices from a website. The issue is that I would like to get the min between all options. For example: It will looks for one cellphone , which has 8GB and it is unlocked B, but I also need that it returns the min price between all options it finds. Google Query Language: How to select the min value?
This is my sheet. This is the google spreadsheet
=QUERY(ImportJSON(C2),"SELECT Col4,Col20 WHERE Col4 CONTAINS '8GB' AND Col4 CONTAINS 'Unlocked B' LIMIT 1 label Col4'',Col20''",1)
how can I modify that formula so it returns the min price? It's like a loop function, is that possible? regardless its color
For example, I want the function to look for the price, it already does, but I would like to get the lowest price it could finds, instead of the first price it finds and matches with the formula
Google-Query Language Reference
try:
=QUERY(IMPORTJSON(C2),
"select Col4,Col20
where Col4 contains '8GB'
and Col4 contains 'Unlocked B'
order by Col20
limit 1
label Col4'',Col20''", 1)
or:
=QUERY(IMPORTJSON(C2),
"select Col4,min(Col20)
where Col4 contains '8GB'
and Col4 contains 'Unlocked B'
group by Col4
order by min(Col20)
limit 1
label Col4'',min(Col20)''", 1)