I have a simple relationship between two parse tables (objects).
Both contain a 'name' string column.
All I need to do is to create a join between the two tables per 'name' column.
For example:
Table A (main) <--> Table B (ancillary)
where
'A.name' == 'B.name'.
Table A is the driving table: all criteria focuses on Table A.
Table B is the ancillary table that has a particular field (column) needed for Table A's result.
Note: the tables don't have any formal relation with each other.
What is the correct Parse syntax to allow this to happen?
...or must I make two queries instead on one merged query?
Related
How can I only select specific columns in a polymorphic relationship because the table columns are different?
$query->with(['Postable' =>function($query){
$query->select('business_title','name ','last_name');
}
The business_title column exists in the agency table. Name and last_name exist in the user table. If I select one table other table gets an error of column not found.
Either develop a naming convention that fulfills your needs (ex: columns like 'name', 'title' can be found on many tables), or do not use select in your query and get all coulmns: $query->with(['Postable']); and you would need appropriate ways to read your query results. Or simply use multiple queries to read from different tables which seems to be the rational option.
I have a list of tables in Powerquery after partitioning from an original big table. I am trying to perform a nested join on each of the tables. Each of the 3 tables will have its own nested join, although the tables joined to and the key-containing columns are different for each table. Eg. List contains table1, table2,table3, table1 to be joined to Table A with table1[Host] as the key, table2 to be joined to Table B with table2[Location] as the key, table3 to be joined to Table C with table3[Name] as the key.
I can do the joins on each table separately (as opposed to having a list of tables), and then combine the output, but it gets unwieldy if there are many tables to be joined. Was wondering if there is a "neater" way to do so.
On a related note, is it possible to invoke different functions (1 function for each table in a list of tables), and how?
Cheers
I have two tables tbl_customer and tbl_policy and i need to join these two tables. But there is no direct relationship of Pkey and Fkey between these two tables. In this case i know that tbl_customer has a field int_policy and in tbl_policy and its primary key int_policy_pk and these two column can be used to join the table.
But in a generalized way i need to write a function to find this relationship (If i don't know about those fields). Is there any algorithms or other ways to do this?
I'm having a problem, i have this table named IMOVEIS and another table named CARACTERISTICAS.
IMOVEIS must do at least 10 joins with CARACTERISTICAS, to get different caracteristics (this is a real state project).
Now I know how to make multiple joins in same table, the problem is: the column name of CARACTERISTICAS table (CT_NOME it's the column's name).
So how to change column name to each join result?
I have a table A and a table B.
Table B has a relationship with A with the key a_id.
I already created the document in a in table A.
I'm wondering how to insert data in a single query using a doc in table B with foreign key A.
r.db('DB').table('B').insert([{
'b_data': ...,
'a_id': r.db('DB').table('a').filter(r.row['name'] == 'some_name')
} for p in a]).run(conn)
You are on the right track, but ReQL differs from the logic of SQL in that it is usually more like a flow. So your query needs to start with the source of the data so it can flow into the insert portion. So here is a version of what I think you want (in Python format):
r.db('DB').table('a').filter({'name':'some_name}).for_each(
r.db('DB').table('b').insert(
{'name':r.row['name'],'b_data':'something'}
)
).run(conn)