Is there a way to call for a cell value when building the SOQL query using G-connector for Google Sheets or Excel?
E.g.
SELECT A FROM B WHERE C= ''Sheet Name'!C5'
Kindly,
Rasmus
Yes there is! :)
SELECT A FROM B WHERE C= '[Sheet Name!C5]'
Related
var pp = gw.api.database.Query.make(entity.PolicyPeriod)
What is the syntax we can use for %like% which we have already been used in SQL to match elements?
Please help me to find the implementation
You can use contains function with 3 parameters, first the Column, second the input value and third a boolean value to ignoreCase (true for denorm the input and column value).
Query.make(PolicyPeriod).contains(PolicyPeriod#PolicyNumber, "123A",
true)
Produces
[%123a%]
SELECT FROM bc_policyperiod gRoot WHERE gRoot.PolicyNumberDenorm LIKE ? AND gRoot.Retired = 0
You can use .contains as mentioned above, and there is also .startsWith() which will do the equivalent of LIKE %text in SQL.
I'm trying to move all my data-processes into R from SQL using odbc since that's where I do all my data cleaning/analysis anyways. In moving my queries to R, I haven't been able to find an easy way to just copy-paste the strings into a readable format. Say I have the following query in SQL:
SELECT
col1,
sum(col2) sum_col2,
col3
FROM
db.table1 t1
WHERE
col1 > 0
AND col6 BETWEEN .5 AND 1.76
GROUP BY
col1,
col3
If I were to try to assign this to a querystring variable in R, I'd put it in a paste, but even then I'd have to go through and separate each line with a comma for it to pass through getDBQuery correctly. Has anyone found an elegant way to copy and paste SQL syntax into R that doesn't require too many fixes? Is there an option in paste that allows you to ignore new lines '\n', or could I create a custom function?
Thank you
As Benjamin explains in the comments, you can simply put your text in quotation marks. Example:
library(sqldf)
df = data.frame(x=c(1,2,3,4,5),y=c(2,2,3,3,3))
my_query = 'SELECT DISTINCT
y FROM
df
where x>3'
df2 <- sqldf(my_query)
there are also tools which generate out of plain SQL the apropriate Java,C#, VB, etc. statement. Just cut & paste.
The formatter I wrote for this purpose is SQLinForm which has several free formatter according to which environment you are working on. Link is enter link description here
I use SQLITE3 for my DB,i have 3 table: Doc table (id,name,date),tag table (id,name,count) and the relation table (id_doc, id_tag) that connect doc and tag table (many to many relation). Now i'm stuck on a query: i want to select the id of document related to tag 1,2 and 3 but i can't figure out how to do this.
anyone can help me?
If I understand correctly, you can use aggregation and having. Something like this:
select id_doc
from relation r
where id_tag in (1, 2, 3)
group by id_doc
having count(*) = 3;
Kindly review this simple SQLite-fiddle .
If any word in the column ITEM of table TWO matches any word in the column NAME_2 of table ONE, there should be a result(s).
Tried many permutes, yet not sure how to form the query for achieving this. Should the GLOBclause be used instead of LIKE, or perhaps some other wildcard patterns?
Many thanks in advance!
As per my comment, I think you can make use of instr as well. For example:
SELECT * FROM Table1 T1, Table2 T2 where instr(T2.NAME_2,T1.ITEM);
The above should return rows where T2.NAME contains a string = T1.ITEM
I wrote a piece of sqlite3 query as following:
CREATE TABLE appearances(
char_id int,
comic_id int
);
CREATE VIEW co-actors AS
SELECT a1.char_id,
a2.char_id
FROM appearances AS a1
LEFT JOIN appearances AS a2 ON a1.comic_id=a2.comic_id;
And it keeps showing up syntax error near '_' in the command shell.
Can anybody help me correct the query? Thanks~
One more question, if I want to select from the View I just created, how do I reference the column,like a1.char_id?
Change co-actors to co_actors
You are using a - where you should be using a _.