Where clause in fusion table query with google map javascript api v3 - google-fusion-tables

I want to put a fusion table layer over my google map using javascript api v3. There are four columns in it: iso, color, name, geometry. My fusion table is:
https://www.google.com/fusiontables/data?docid=1uO0anbhABVwjktSOy-PJsGo0Q4y-gTtzAe607c8
Why I can filter with: where: 'color=0'
but cannot filter with: where: 'iso="AU"'
'color' column type is number and 'iso' column type is text.
Any syntax error in that query? Thank you.

Oh, I find out why.
The where clause should be changed to where: "iso='AU'".
Double quotes should surround single quotes.

Related

Refining a Query formula with two 'where' conditions

I need to write a Query formula to pull through unique values from another sheet, excluding rows that contain certain keywords and also excluding any empty rows.
I've written this formula:
=UNIQUE(QUERY('Sheet Name'!A1:AZ,"Select A where A is not null and where not A contains 'STRING'",1))
Unfortunately this gives a VALUE error. It works with either of the 'where' clauses but not with both.
What am I missing?
You don't need to add the seconde 'Where', it just implies that you continue to add conditions into that statement:
=UNIQUE(QUERY('Sheet Name'!A1:AZ,"Select A where A is not null and not A contains 'STRING'",1))

PowerAutomate : Get max columnvalue From dataverse table

I have a Dataverse table named my_sample_table.
Inside the table I have a column named my_sample_column of type integer whose max value should be returned. Am trying to achieve this by using the List rows action provided with PowerAutomate.
Is there a filter query that can be written on the Filter rows property ? similar to what we use with SQL : max(columnname)
Or any other queries that can be included in the List rows action which will return the same result.
I know that I can iterate through the column values to get the max value using an expresion or by sorting it and getting the topmost one. But I was wondering whether there are any direct approach to it.
I would try and use a max aggregate for this column in a Fetch Xml query:
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/use-fetchxml-aggregation#max

Get all the rows raleted with a specific string

I am using rails with a postgresql db, and I would like to know which is the best solution, in getting all the rows which are similar with a string.
string format: domain.com or domain.com/uk or subdomain.domain.com
db column format : http://www.test.com/All-test/test1/test2-test3/
So I would like to get from my table all the rows which are matching with my string.
Currently I have a script which is going through all the rows in my table, and taking the column values, from where it takes the host and compares it with the string.
Thank you
Looks like the LIKE function is what you want to use. You can use in in an ActiceRecord query like this:
search_string = "domain.com"
YourModel.where("db_column LIKE ?", "%#{search_string}%").first
You might need to refine the search, but the link above should give you all the tools you need

Join 2 tables in Hive using a phone number and a prefix (variable length)

I'm trying to match phone numbers to an area using Hive.
I've got a table (prefmap) that maps a number prefix (prefix) to an area (area) and another table (users) with a list of phone numbers (nb).
There is only 1 match per phone number (no sub-area)
The problem is that the length of the prefixes is not fixed so I cannot use the UDF function substr(nb,"prefix's length") in the JOIN's ON() condition to match the substring of a number to a prefix.
And when I try to use instr() to find if a number has a matching prefix:
SELECT users.nb,prefix.area
FROM users
LEFT OUTER JOIN prefix
ON (instr(prefmap.prefix,users.nb)=1)
I get an error on line4 "Both left and right aliases encountered in Join '1')
How could I get this to work?
I'm using hive 0.9
Thanks for any advice.
Probably not the best solution but at least it does the job:
use WHERE to define the matching condition instead of ON() (that is now forced to TRUE)
select users.nb, prefix.area
from users
LEFT OUTER JOIN prefix
ON(true)
WHERE instr(users.nb,prefmap.prefix)=1
It's not perfect as it's a bit slow. It creates as many temporary (useless) entries as there are in the matching table before the WHERE condition keeps the only right one. So it's better to use this only if it's not too long.
Can anyone think of a better way to do this?
hive cannot convert (instr(prefmap.prefix,users.nb)=1) to mapreduce job.
so hive's join just support equality expression. see hive joins wiki for more information.

Fusion tables query does not fetch some

I'm having an issue on this table: 1g_ydg74ooUSBzNfQBHOIdgrOKhxZD_92In8xTDg
I'm trying to fetch some results by CODE_DEPT. I used the filter
CODE_DEPT IN ('001', '002', '003', '02A', '02B')
and only the 3 first are fetched.
Any idea what's going on ?
Cheers
Looks like CODE_DEPT is identified as a numeric column. The last two codes are not numeric and so would not match anything. If you change the column to type Text and you should be OK.

Resources